Home Site map Contacts CZ

Jan Ringoš, Tringi Netbase

Papers & C++  »  Libraries and sources  » 

int128

Now generic double_integer template that doubles width of any integral data type, even recursively. int128 and uint128 were similar classes for operations over native little-endian 128-bit numbers. Unlike other large number classes, you can work with double_integer instantiated types just like with other P.O.D. types.

Important note: Currently two versions are available. Latest is provided right below. Only the double_integer template is available so far, and that needs to be instantiated, but that is obvious and trivial thing to do, see the double_integer.hpp comments for details.
The older, complete but a little buggy one is in the second half of the page.
Download

Download: int128-1.9.2.zip

Preview of the new library. Version 1.9.2
File size: 4.9 kB

Details

The new version of the library is (will be) built on top a template called double_integer which representation-wise correctly (little-endian) doubles width of any arbitrary integral data type. C++11 compiler support is required.

Key features

  • Objects correctly represent the data type they simulate for little-endian platform, P.O.D. aka standard layout type.
  • The std::numeric_limits is correctly overloaded for every instantiated double_integer.
  • Nesting instantiations is valid way to create 256-bit integers, 512-bit integers and even arbitrarily larger ones.
  • [...]

Legacy, no longer maintained, version of the library

Download

Download: int128.zip

Legacy classes int128 and uint128. Version 1.1
File size: 6.6 kB

Known issues

  • Operator - is wrong for both classes
  • Bound to the GCC compiler
  • Only 128 bit wide
  • None unit test whatsoever

License

int128 s a free software available under the zlib license.
For detailed text of the license see The zlib License.

exertion of the imagination, portfolio library and software repository