{"id":31959918,"url":"https://github.com/stepainpy/fwnbi","last_synced_at":"2025-10-14T15:51:12.109Z","repository":{"id":318008446,"uuid":"1067424921","full_name":"Stepainpy/fwnbi","owner":"Stepainpy","description":"Fixed-width N-bit integers","archived":false,"fork":false,"pushed_at":"2025-10-04T12:25:43.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-04T14:31:26.145Z","etag":null,"topics":["arbitrary-precision-integers","cpp","cpp14","fixed-width","integer","integer-arithmetic","integers","karatsuba-multiplication","std"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Stepainpy.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-30T20:57:30.000Z","updated_at":"2025-10-04T12:25:46.000Z","dependencies_parsed_at":"2025-10-04T14:31:30.314Z","dependency_job_id":"adeeddc2-2149-42cd-8574-70c4a6cd95de","html_url":"https://github.com/Stepainpy/fwnbi","commit_stats":null,"previous_names":["stepainpy/fwnbi"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Stepainpy/fwnbi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stepainpy%2Ffwnbi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stepainpy%2Ffwnbi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stepainpy%2Ffwnbi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stepainpy%2Ffwnbi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Stepainpy","download_url":"https://codeload.github.com/Stepainpy/fwnbi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stepainpy%2Ffwnbi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279019303,"owners_count":26086711,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"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":["arbitrary-precision-integers","cpp","cpp14","fixed-width","integer","integer-arithmetic","integers","karatsuba-multiplication","std"],"created_at":"2025-10-14T15:51:11.299Z","updated_at":"2025-10-14T15:51:12.104Z","avatar_url":"https://github.com/Stepainpy.png","language":"C++","readme":"# Fixed-width N-bit integers\r\n\r\n## Overview\r\n\r\nImplement template class `fwnbi::basic_integer\u003csize_t Bits, class DigitT, bool Signed\u003e`\r\nwith semantic as fundamental integer types.\r\n\r\nValid values of `Bits`: $2^n$, where $n \u003e 0$ and $\\text{Bits} \\ge \\text{bits in DigitT}$.  \r\nValid values of `DigitT`: `uint8_t`, `uint16_t`, `uint32_t`\r\n(and `uint64_t` if available type `__uint128_t`, GCC extension).\r\n\r\nFor multiplication use, the Karatsuba algorithm.\r\n\r\n## Namespace `fwnbi`\r\n\r\n### Class `basic_integer\u003csize_t Bits, class DigitT, bool Signed\u003e`\r\n\r\n**Types:**  \r\n`digit_type` - equal template parameter `DigitT`  \r\n`double_digit_type` - type with width twice as wide as `digit_type`\r\n\r\n**Static constants:**  \r\n`bit_width` - equal template parameter `Bits`  \r\n`digit_width` - bit width of `digit_type`  \r\n`digit_count` - count of digits in `basic_integer\u003c...\u003e`  \r\n`is_signed` - equal template parameter `Signed`\r\n\r\n**Static functions:**  \r\n`max()` - return max value for current `basic_integer\u003c...\u003e`  \r\n`min()` - return min value for current `basic_integer\u003c...\u003e`\r\n\r\n**Constructors:**  \r\n`basic_integer()` - default constructor (set all zero)  \r\n`basic_integer(digit_type)` - create integer from one digit  \r\n`basic_integer(const digit_type (\u0026)[digit_count])` - create integer from array of digits\r\n\r\n**Conversions:**  \r\n`bool` - `true` if integer is zero, otherwise `false`  \r\n`digit_type` - return first digit  \r\n`double_digit_type` - return first and second digit  \r\n`basic_integer\u003c!Signed, ...\u003e` - toggle sign of integer  \r\n`basic_integer\u003cBgBits, ...\u003e` - expand bit width, $\\text{BgBits} \u003e \\text{Bits}$  \r\n`basic_integer\u003cTnBits, ...\u003e` - narrow bit width, $\\text{TnBits} \u003c \\text{Bits}$  \r\n`basic_integer\u003cOtherDigitT, ...\u003e` - change digit type, $\\text{OtherDigitT} \\ne \\text{DigitT}$\r\n\r\n**Comparison:**  \r\n`int compare(const basic_integer\u003c...\u003e\u0026)` - 3-way comparison  \r\n`std::strong_ordering operator\u003c=\u003e(const basic_integer\u003c...\u003e\u0026)` *since C++20* - standard 3-way comparison\r\n\r\n**Support methods:**  \r\n`bool sign_bit()` - return value of MSB  \r\n`int sign()` - n \u003e 0 =\u003e +1, n = 0 =\u003e 0, n \u003c 0 =\u003e -1  \r\n`void clear()` - set all digits in zero  \r\n`bool bit(size_t)` - return value of bit by index, $0 \\le \\text{index} \u003c \\text{Bits}$  \r\n`void bit(size_t, bool)` - set bit by index, $0 \\le \\text{index} \u003c \\text{Bits}$  \r\n`uint8_t hex(size_t)` - return value of hex digit by index, $0 \\le \\text{index} \u003c \\frac{\\text{Bits}}{4}$  \r\n`void hex(size_t, uint8_t)` - set hex digit by index, $0 \\le \\text{index} \u003c \\frac{\\text{Bits}}{4}$  \r\n`void split(basic_integer\u003cBits/2, ...\u003e\u0026, basic_integer\u003cBits/2, ...\u003e\u0026)` - split current integer by upper and lower parts  \r\n`void merge(const basic_integer\u003cBits/2, ...\u003e\u0026, const basic_integer\u003cBits/2, ...\u003e\u0026)` - merge upper and lower parts to current integer  \r\n`basic_integer\u003cBgBits, ...\u003e expand()` - expand bit width without copy sign bit, $\\text{BgBits} \u003e \\text{Bits}$  \r\n`bool add_with_carry(const basic_integer\u003c...\u003e\u0026, bool = false)` - add first and second argument to integer and return carry  \r\n`bool add_with_carry(digit_type, bool = false)` - add first and second argument to integer and return carry  \r\n`void swap(basic_integer\u003c...\u003e\u0026)` - swap value of current integer and argument\r\n\r\n**Additional operators:**  \r\n`digit_type\u0026 operator[](size_t)` - return digit by index  \r\n`\u003c\u003c`, `\u003e\u003e`, `\u003c\u003c=`, `\u003e\u003e=` - if count is negative turn left/right to right/left\r\n\r\n### Functions\r\n\r\n`fullmul` - return 2N-bit result of multiplication N-bit integers  \r\n`abs` - return absolute value of integer  \r\n`rotl`/`rotr` - bit rotation, if count is negative turn left/right to right/left  \r\n`clz` - return count `0`-bit from MSB to before first `1`-bit  \r\n`ctz` - return count `0`-bit from LSB to before first `1`-bit  \r\n`popcount` - return count of `1`-bit in integer  \r\n`sqr` - return square of integer with twice width  \r\n`isqrt` - return `floor(sqrt(x))` of integer  \r\n`gcd` - return greate common divisor  \r\n`lcm` - return least common multiplier\r\n\r\n### Default provided type aliases\r\n\r\n`uintN_t\u003cBits, DigitT = uint32_t\u003e`/`intN_t\u003cBits, DigitT = uint32_t\u003e` - aliases with preset signedness  \r\n`uint128_t`/`uint256_t`/`uint512_t`/`uint1024_t` - unsigned aliases  \r\n`int128_t`/`int256_t`/`int512_t`/`int1024_t` - signed aliases\r\n\r\n## Namespace `fwnbi::literals`\r\n\r\n`_ull128`/`_ull256`/`_ull512`/`_ull1024` - unsigned  \r\n`_ll128`/`_ll256`/`_ll512`/`_ll1024` - signed\r\n\r\n## Namespace `std`\r\n\r\n`void swap(...)` - swapping to integers  \r\n`struct numeric_limits` - information about `basic_integer\u003c...\u003e`  \r\n`struct is_integral` - return `true`  \r\n`struct is_unsigned`/`struct is_signed` - answer by question  \r\n`struct make_unsigned`/`struct make_signed` - return type  \r\n`struct hash` - calculate function FNVa-64 for bytes in integer  \r\n`std::string to_string(...)` - convert integer to `std::string`  \r\n`... strtoll(...)` - convert C-string to signed integer  \r\n`... strtoull(...)` - convert C-string to unsigned integer  \r\n`... operator\u003c\u003c(...)` - output to `std::basic_ostream\u003c...\u003e`  \r\n`... operator\u003e\u003e(...)` - input from `std::basic_istream\u003c...\u003e`  \r\n`... to_chars(...)` *since C++17* - fast convert to string  \r\n`... from_chars(...)` *since C++17* - fast convert from string  \r\n`struct formatter\u003c...\u003e` *since C++20* - helper class for format library","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstepainpy%2Ffwnbi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstepainpy%2Ffwnbi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstepainpy%2Ffwnbi/lists"}