{"id":13590502,"url":"https://github.com/nemequ/portable-snippets","last_synced_at":"2025-04-04T07:08:53.431Z","repository":{"id":37677992,"uuid":"65313379","full_name":"nemequ/portable-snippets","owner":"nemequ","description":"Collection of miscellaneous portable C snippets.","archived":false,"fork":false,"pushed_at":"2024-01-16T20:25:23.000Z","size":265,"stargazers_count":670,"open_issues_count":22,"forks_count":65,"subscribers_count":24,"default_branch":"master","last_synced_at":"2024-08-02T16:35:05.472Z","etag":null,"topics":["atomic","builtin","c","clock","csprng","intrinsic","monotonic","overflow","portable","prng","public-domain","random","time","unaligned"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nemequ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-09T17:08:47.000Z","updated_at":"2024-07-31T23:30:11.000Z","dependencies_parsed_at":"2024-05-28T09:53:36.142Z","dependency_job_id":"b106ea19-bb39-4a76-95a1-777010042981","html_url":"https://github.com/nemequ/portable-snippets","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemequ%2Fportable-snippets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemequ%2Fportable-snippets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemequ%2Fportable-snippets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemequ%2Fportable-snippets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nemequ","download_url":"https://codeload.github.com/nemequ/portable-snippets/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247135144,"owners_count":20889421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["atomic","builtin","c","clock","csprng","intrinsic","monotonic","overflow","portable","prng","public-domain","random","time","unaligned"],"created_at":"2024-08-01T16:00:46.492Z","updated_at":"2025-04-04T07:08:53.412Z","avatar_url":"https://github.com/nemequ.png","language":"C","readme":"# Portable Snippets\n\nThis is a collection of public domain (CC0) code snippets written in C\nfor performing various common tasks which are typically OS,\narchitecture, and/or compiler-dependent.  Basically, our goal is to\nmove those annoying preprocessor conditionals from your code to ours.\n\nModules have no fixed target (such as C89) since that would preclude\nsome functionality; instead, we simply try to provide the widest\nsupport we can for each module.  If you have a platform which isn't\nsupported for a particular feature but could be, please let us know;\nwe'd be happy to try to work out a way to support it.\n\nEverything is tested continuously with various versions of GCC, Clang,\nand PGI ([on Travis\nCI](https://travis-ci.org/nemequ/portable-snippets)), MSVC ([on\nAppVeyor](https://ci.appveyor.com/project/quixdb/portable-snippets)),\nand Emscripten (on\n[Codefresh](https://g.codefresh.io/repositories/nemequ/portable-snippets/builds?filter=trigger:build;branch:master;service:591f783d728f4b0001051d3e~portable-snippets)):\n\n[![Travis CI status](https://travis-ci.org/nemequ/portable-snippets.svg?branch=master)](https://travis-ci.org/nemequ/portable-snippets) [![AppVeyor status](https://ci.appveyor.com/api/projects/status/quoq2hwes530p29w/branch/master?svg=true)](https://ci.appveyor.com/project/quixdb/portable-snippets/branch/master) [![Codefresh status](https://g.codefresh.io/api/badges/build?repoOwner=nemequ\u0026repoName=portable-snippets\u0026branch=master\u0026pipelineName=portable-snippets\u0026accountName=nemequ\u0026type=cf-1)](https://g.codefresh.io/repositories/nemequ/portable-snippets/builds?filter=trigger:build;branch:master;service:591f783d728f4b0001051d3e~portable-snippets)\n\nCurrently ready-to-use modules include:\n\n * [builtin](https://github.com/nemequ/portable-snippets/tree/master/builtin) —\n   use compiler built-ins/intrinsics, or fall back on standard C\n * [endian](https://github.com/nemequ/portable-snippets/tree/master/endian) —\n   endianness detection and swapping\n * [atomic](https://github.com/nemequ/portable-snippets/tree/master/atomic) —\n   common atomic synchronization operations\n * [safe-math](https://github.com/nemequ/portable-snippets/tree/master/safe-math) —\n   overflow-safe integer functions\n * [exact-int](https://github.com/nemequ/portable-snippets/tree/master/exact-int) —\n   exact-width integer types (think `\u003cstdint.h\u003e`)\n * [clock](https://github.com/nemequ/portable-snippets/tree/master/clock) —\n   cross-platform wall clock, CPU time, and monotonic time\n\nThere are also modules which may not yet be ready for widespread use, but\nwould benefit greatly from testing:\n\n * [unaligned](https://github.com/nemequ/portable-snippets/tree/master/unaligned) —\n   fast unaligned loads \u0026 stores\n * [once](https://github.com/nemequ/portable-snippets/tree/master/once) —\n   one-time initialization\n * [random](https://github.com/nemequ/portable-snippets/tree/master/random) —\n   random number generation (3 flavors: cryptographic, reproducible, and fast)\n * [debug-trap](https://github.com/nemequ/portable-snippets/tree/master/debug-trap) —\n   debugging traps and assertions\n * [check](https://github.com/nemequ/portable-snippets/tree/master/check) —\n   assertion checking\n\nModules can be used in isolation, though some do work better together,\nso if you can keep the whole repository together instead of just\ncopying a single file we recommend you do so.\n\nPlease don't be shy about filing issues about any of these; if you\nhave problems it's likely others will, as well, so we would like to\nfix them.\n\nIf you have something you would like to contribute, please file an\nissue or pull request.  If you'd like to help out by writing something\nnew, take a look at the [\"enhancement\"\nissues](https://github.com/nemequ/portable-snippets/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement)\nin our issue tracker for ideas.\n\nSome things don't really fit this repository, so here are a few\nsmall-ish projects for doing things portably which you may be\ninterested in:\n\n * [Hedley](https://nemequ.github.io/hedley/) — macros to enable\n   compiler-specific features which make your code easier to use,\n   harder to misuse, safer, faster, and more portable.\n * [parg](https://github.com/jibsen/parg) —\n   Argument parsing similar to getopt/getopt_long.  Public domain.\n * [TinyCThread](https://tinycthread.github.io/) — Implements the C11\n   threads API on top of pthreads and the Windows API.  zlib license.\n * [win-iconv](https://github.com/win-iconv/win-iconv) — Windows\n   implementation of the iconv API (character set conversion).\n * [mman-win32](https://github.com/witwall/mman-win32) — `mman.h`\n   (`mmap()`, *etc.*) implementation for Windows.\n\nIf there is a project you'd like to see added to the list, please file\nan issue or pull request.\n","funding_links":[],"categories":["C","Common","utility"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnemequ%2Fportable-snippets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnemequ%2Fportable-snippets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnemequ%2Fportable-snippets/lists"}