https://github.com/ckormanyos/long_long_long
Implements signed and unsigned integers consisting of four constituent parts such as a synthesized 128-bit integer or similar
https://github.com/ckormanyos/long_long_long
Last synced: 3 days ago
JSON representation
Implements signed and unsigned integers consisting of four constituent parts such as a synthesized 128-bit integer or similar
- Host: GitHub
- URL: https://github.com/ckormanyos/long_long_long
- Owner: ckormanyos
- License: bsl-1.0
- Created: 2025-03-22T11:45:27.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2025-03-23T09:04:59.000Z (about 1 month ago)
- Last Synced: 2025-04-24T03:48:42.262Z (3 days ago)
- Language: C++
- Homepage:
- Size: 75.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
long_long_long
==================This is a legacy project that preserves an old work.
New designs should use [`ckormanyos/wide-integer`](https://github.com/ckormanyos/wide-integer)
or [`boost::multiprecision`](https://github.com/boostorg/multiprecision) or similar.`ckormanyos/long_long_long` implements signed and unsigned integers consisting of four constituent parts
such as a synthesized drop-in replacement for `uint128_t` or similar.Use the C++ templates `unsigned_long_long_long` and `signed_long_long_long`
to create unsigned or signed _long_ _long_ _long_ integers (i.e., like `uint128_t`).
See the detailed example below.The `unsigned_long_long_long` and `signed_long_long_long` template classes
are located in `namespace` `math::lll`.```cpp
#include#include
auto main() -> int
{
using uint128_t = math::lll::unsigned_long_long_long;uint128_t p3 { uint128_t { 3 } };
p3 *= p3;
p3 *= p3;
p3 *= p3;
p3 *= p3;
p3 *= p3;
p3 *= p3;// 3^64
const uint128_t
ctrl
{
uint128_t { UINT64_C(1853020188851841) }
* uint128_t { UINT64_C(1853020188851841) }
};// 3433683820292512484657849089281
std::cout << "p3: " << p3 << std::endl;return (p3 == ctrl) ? 0 : -1;
}
```