Skip to content

Is there a way to make uint128_t really 128 bit? #666

@pps83

Description

@pps83

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 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions