{"id":20173230,"url":"https://github.com/aeckar/libnumsys","last_synced_at":"2026-05-19T06:06:50.710Z","repository":{"id":233446959,"uuid":"376121390","full_name":"aeckar/libnumsys","owner":"aeckar","description":"Number system conversion library and command-line utility for C/C++","archived":false,"fork":false,"pushed_at":"2021-09-03T02:41:03.000Z","size":150,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-07T07:03:21.331Z","etag":null,"topics":["binary","c","cpp","hexadecimal","number-converter"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aeckar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-06-11T19:15:23.000Z","updated_at":"2021-09-03T02:41:46.000Z","dependencies_parsed_at":"2024-05-03T02:28:35.463Z","dependency_job_id":null,"html_url":"https://github.com/aeckar/libnumsys","commit_stats":null,"previous_names":["ladle-gh/libnumsys","aeckar/libnumsys"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aeckar/libnumsys","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aeckar%2Flibnumsys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aeckar%2Flibnumsys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aeckar%2Flibnumsys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aeckar%2Flibnumsys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aeckar","download_url":"https://codeload.github.com/aeckar/libnumsys/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aeckar%2Flibnumsys/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33204124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T09:27:30.708Z","status":"online","status_checked_at":"2026-05-19T02:00:06.763Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["binary","c","cpp","hexadecimal","number-converter"],"created_at":"2024-11-14T01:34:14.742Z","updated_at":"2026-05-19T06:06:50.696Z","avatar_url":"https://github.com/aeckar.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# libnumsys\nNumber system conversion library made in C.\n\n## Reasoning\nIn many applications of computer science, it is necessary to differentiate between the different number systems that programmers use on a day-to-day basis. The most common of these include binary, octal, and hexadecimal. Although one can simply practice conversion between them and regular decimal, such a feat is simply not practical for everyone who needs to use these representations. Because of the need for a fast and convenient number system converter, I created this library.\n\n## Usage Notes\nAt a glance, the library's features include:\n```C++\n// Information pertaining to a number's string representation\ntypedef struct numinfo_t {\n    unsigned min;   // Minimum # of digits\n    unsigned space; // # of digits between spaces, 0 for no spaces\n} numinfo_t;\n\n// Negative number representation type\ntypedef enum {\n    NR_NEGSGN = 1, // Append negative sign to front\n    NR_SPLACE = 2, // Append nonzero digit to front\n    NR_1COMPL = 4, // Set as complement of positive\n    NR_2COMPL = 8  // Set as complement of positive plus 1\n} numrep_t;\n\n// Number system type\ntypedef struct {\n    unsigned base;\n    numrep_t rep;\n} numsys_t;\n\n// Converts string in given base/representation to integer\nlong long nsys_tonum(const char *, numsys_t);\nunsigned long long nsys_utonum(const char *, unsigned);   // Unsigned ver.\n\n// Converts string in one base/representation to string in another\nchar *nsys_conv(const char *, numsys_t, numsys_t, numinfo_t);\nchar *nsys_uconv(const char *, unsigned, unsigned, numinfo_t);\n\n// Converts integer to string in given base/representation\nchar *nsys_tostr(long long, numsys_t, numinfo_t);\nchar *nsys_utostr(unsigned long long, unsigned, numinfo_t);\n```\nThe library contains a single header, `numsys.h`, from which further information can found.\n\nIf using the library with standard C99 or later, it is useful to know that arguments of type `numsys_t` can be passed without the use of a temporary buffer by using a [compound literal](https://en.cppreference.com/w/c/language/compound_literal). Underscores are allowed in number strings, and are encouraged to preserve readability.\n```C\nnsys_tonum(\"1_028\", (numsys_t){10, NEG_SIGN});\n```\nSimilarly, in C++, arguments of type `numsys_t` can be passed using an [initializer list](https://en.cppreference.com/w/cpp/utility/initializer_list), as `numsys_t` is considered a [POD type](https://stackoverflow.com/questions/146452/what-are-pod-types-in-c).\n```C++\nnsys_tostring(0b101101, {2, SIGN_PLACE});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faeckar%2Flibnumsys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faeckar%2Flibnumsys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faeckar%2Flibnumsys/lists"}