An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

        

long_long_long
==================



Build Status


Boost Software License 1.0



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;
}
```