{"id":16002882,"url":"https://github.com/soreing/bigint-x86cpp","last_synced_at":"2025-08-22T13:16:07.405Z","repository":{"id":110409707,"uuid":"392636787","full_name":"Soreing/bigint-x86cpp","owner":"Soreing","description":"Big Integer library for C++ partially written in x86 Assembly","archived":false,"fork":false,"pushed_at":"2021-08-08T20:30:32.000Z","size":18,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-10T09:43:47.243Z","etag":null,"topics":["asm","asmx86","assembly-x86","bigint","biginteger","biginteger-cpp","biginteger-library","cpp"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Soreing.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-08-04T09:57:50.000Z","updated_at":"2024-08-02T08:50:21.000Z","dependencies_parsed_at":"2023-12-23T09:15:07.231Z","dependency_job_id":null,"html_url":"https://github.com/Soreing/bigint-x86cpp","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/Soreing%2Fbigint-x86cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soreing%2Fbigint-x86cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soreing%2Fbigint-x86cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soreing%2Fbigint-x86cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Soreing","download_url":"https://codeload.github.com/Soreing/bigint-x86cpp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247274109,"owners_count":20912051,"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":["asm","asmx86","assembly-x86","bigint","biginteger","biginteger-cpp","biginteger-library","cpp"],"created_at":"2024-10-08T10:04:43.515Z","updated_at":"2025-04-05T01:26:14.395Z","avatar_url":"https://github.com/Soreing.png","language":"C++","readme":"# bigint-x86cpp\n\n# Description\n\nbigint-x86cpp is a C++ library for working with unsigned integers larger than 64bits. The library uses x86 assembly for certain basic operations and does not use dynamic memory, instead it uses templates to create BigInt objects of differetn sizes. Most operators are implemented, as well as reading and printing in different bases from binary to base64.\n\n# Installation \nAdd the folder `bigint` folder from `/include` in your include path. You will not need to compile any source files, but they are necessary to be included with the template definition.\n\n# Usage\n## Creating Big Integers\nTo create a big integer, you need to specify how many bytes large you want it to be. You can assign to the Big Integer a number, or a string that represents a number. You can specify the number's base with a prefix.\n```c++\n// 16 byte large BigInt\nBigInt\u003c16\u003e num   = 123;\n\nBigInt\u003c16\u003e str2  = \"0b11010101\";  // Binary (0b)\t\nBigInt\u003c16\u003e str8  = \"0123456701\";  // Octal (0)\nBigInt\u003c16\u003e str10 = \"1234567890\";  // Decimal (non zero)\nBigInt\u003c16\u003e str16 = \"0x1234ABCD\";  // Hexadecimal (0x)\nBigInt\u003c16\u003e str64 = \"0#a2GQs61=\";  // base 64 (0#)\n```\n\n## Input / Output\nYou can use the stream operators for reading into and printing the value of Big Ints. The numbers are printed in base 10. If you want to print in another base, you need to use the `.toString()` function.\n```c++\nBigInt\u003c16\u003e num;\n\ncin \u003e\u003e num;  // Using the string constructors\ncout \u003c\u003c num;  // Prints number in base 10\n\n// Print numbers in different bases wit or without prefix\ncout \u003c\u003c num.toString(64);\ncout \u003c\u003c num.toString(16, true);\n```\n\n## Arithmetic Operators\nYou can use arithmetic operators on Big Ints of the same size, including compound assignment operators.\n```c++\nBigInt\u003c16\u003e left  = \"1234567\";\nBigInt\u003c16\u003e right = \"4567890\";\n\ncout \u003c\u003c left + right  \u003c\u003c endl;\ncout \u003c\u003c left - right  \u003c\u003c endl;\ncout \u003c\u003c \"123\" * right \u003c\u003c endl;\ncout \u003c\u003c left / \"123\"  \u003c\u003c endl;\ncout \u003c\u003c left % \"123\"  \u003c\u003c endl;\n```\n```\nOutput:\n5802457\n3333323\n151851741\n37137\n39\n```\n\n## Bitwise Operators\nBitwise `\u0026`, `|`, `^`, as well as the bitshift `\u003c\u003c`, `\u003e\u003e` operators are implemented for Big Ints of the same size.\n```c++\nBigInt\u003c16\u003e bin1 = \"0b1101001010\";\nBigInt\u003c16\u003e bin2 = \"0b1010010101\";\nBigInt\u003c16\u003e result;\n\nresult = bin1 \u0026 bin2;\nresult = bin1 | \"0b0010010101\";\nresult = \"0b1101001010\" ^ bin2;\nresult = ~bin2;\n```\n\n## Relational Operators\nYou can compare the value of Big Ints of the same size with the relational operators\n```c++\nBigInt\u003c16\u003e num1 = \"321456456546\";\nBigInt\u003c16\u003e num2 = \"12\";\n\ncout \u003c\u003c (num1 \u003c   num2) \u003c\u003c \" \";\ncout \u003c\u003c (num1 \u003e   num2) \u003c\u003c \" \";\ncout \u003c\u003c (num1 ==  num2) \u003c\u003c \" \";\ncout \u003c\u003c (num1 !=  num2) \u003c\u003c \" \";\n```\n```\nOutput:\n0 1 0 1\n```\nFor fast comparison, you can use the `.isZero()` function that doesn't require a second operand\n```c++\nBigInt\u003c16\u003e num = \"321456456546\";\n\n// Prints 0 for false, the number is not zero\ncout \u003c\u003c num.isZero() \u003c\u003c endl;\n```\n\n## Logical Operators\nBig Integers convert to false if they are zero, otherwise convert to true. You can use them in conditions or in logical operations\n```c++\nBigInt\u003c16\u003e nonzero = \"12345\";\n\nif(nonzero){\n    cout \u003c\u003c \"true\\n\";\n}\n\ncout \u003c\u003c (nonzero \u0026\u0026 nonzero) \u003c\u003c \" \";\ncout \u003c\u003c (nonzero \u0026\u0026 false) \u003c\u003c \" \";\ncout \u003c\u003c (false || nonzero) \u003c\u003c \" \";\n```\n```\nOutput:\ntrue\n1 0 1\n```\n\n## Additional Features\nYou can generate random Big Ints with a template Rand function. You can seed the default c rand function with `srand()` to set the seed for this function.\n```c++\nsrand(1234);\nBigInt\u003c256\u003e rnum = rand\u003c256\u003e();\n```\n\nThere is a pow function implemented for Big Ints. You need to provide the result's size as a template parameter, then supply the parameters\n```c++\n// 123^456\nBigInt\u003c512\u003e num = pow\u003c512\u003e(\"123\", \"456\");\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoreing%2Fbigint-x86cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoreing%2Fbigint-x86cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoreing%2Fbigint-x86cpp/lists"}