boostorg / boostorg/multiprecision

Is there a way to make uint128_t really 128 bit?

Open
#666 33 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
C++
Stars
265
Forks
128
Avg merge
4h 48m
Merged PRs (30d)
2

Description

Not sure if it was raised by others, but is there a way to actually make uint128_t to be 128 bit? For some reason, I have mental rejection from using boost::multiprecision::uint128_t / int128_t because it's not true 128 bit int.
I just saw explanation why [boost::multiprecision::uint128_t sizeof is 24](https://stackoverflow.com/questions/41876253/boostmultiprecisionuint128-t-sizeof-is-24) and it might make sense for some huge numbers, but not sure if it makes sense for 128 bit. To me it feels like uint64_t that was only usable for 60 bits with some bits used to track what 16-bit num is in use, or, as if uint64_t was actually 80bit in size. Both aren't OK imo if there was no way to opt out from it. Also, instead of using some var, to keep track of what's set, obviously, it would be better to comply test the number itself (if it's meant for checking zero or not).
IMO, it would be better if uint128_t/int128_t from boost at least generated optimal code for regular math operations. Even `__msvc_int128.hpp` is more than 2x faster in my tests for basic calculations.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.