Re: [boost][int128] Formal Review Begins Today (July 22-July 31)

Matt Borland via Boost <[email protected]> Sat, 01 Aug 2026 13:55:59 +0000
Newsgroups gmane.comp.lib.boost.devel
Message-ID <D7Dmg17sEQdQ13wwGdHoNIJTd3z9RQikWDCvV3FDkFj40CCcxq2Z0DXeid3zMmEX3zZrRBXvrfSLwy9Nwgw3US2FFB07fXuhdGwz4rCjwp0=@mattborland.com>
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--===============0486387186436158779==
Content-Type: multipart/signed; protocol="application/pgp-signature";
 micalg=pgp-sha512;
 boundary="------32ea78406c308eebe4512e96a11c7a09c19d3283e0e2b6efae0181f5b9542308";
 charset=utf-8

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--------32ea78406c308eebe4512e96a11c7a09c19d3283e0e2b6efae0181f5b9542308
Content-Type: multipart/mixed;boundary=---------------------734da7fd1387bb146e34b17d8c05ec7c

-----------------------734da7fd1387bb146e34b17d8c05ec7c
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;charset=utf-8


> >    - Did you try to use the library? With what compiler? Did you have =
any
> > problems?
> =


> I did but as we use a pattern like this in our code:
> =


> enum class big_quantity : int128_type
> {
>      none =3D std::numeric_limits<int128_type>::max()
> };
> =


> which of course doesn't work with this type so it was not useful.
> However I could potentially create a derived class that has the same
> benefit possibly (I want a named integer type) but then I'd have to
> rewire a bunch of other stuff. I did enough to see that we could
> potentially have this work but it was too much effort for this review.
> =



I have not tried this, but for whatever it's worth Claude (Opus 5 Max) rec=
ommends the following:

Works everywhere including MSVC and SYCL device:                          =
                                                                          =
                                                                          =
                                                      =


                                                                          =
                                                                          =
                                                                          =
                                                                          =
           =


  struct big_quantity                                                     =
                                                                          =
                                                                          =
                                                                          =
           =


  {                                                                       =
                                                                          =
                                                                          =
                                                                          =
           =


      boost::int128::int128 value {};                                     =
                                                                          =
                                                                          =
                                                                          =
           =


                                                                          =
                                                                          =
                                                                          =
                                                                          =
           =


      static const big_quantity none;                                     =
                                                                          =
                                                                          =
                                                                          =
           =


  };                                                                      =
                                                                          =
                                                                          =
                                                                          =
           =


                                                                          =
                                                                          =
                                                                          =
                                                                          =
           =


  constexpr big_quantity big_quantity::none {std::numeric_limits<boost::in=
t128::int128>::max()};                                                    =
                                                                          =
                                                                          =
           =


                                                                          =
                                                                          =
                                                                          =
                                                                          =
           =


  Verified usable in constant expressions. You supply operator=3D=3D/opera=
tor!=3D yourself pre-C++20. What you lose versus enum class is switch exha=
ustiveness and implicit-conversion blocking.


> We use __int128 in our codebase for exactly the reasons listed in the
> rationale but sadly this would not be a trivial drop-in replacement but
> I could see how it might be useful if we needed it. We do need an int256
> type that's lightweight and performant and if we had that I could see us
> using this as well as for that it would be worth working out the
> (extensive) reworking of the enum pattern.
> =


> That said I think this library is a valuable addition (but int256 would
> be even more useful ;-)) so I vote to ACCEPT the library.
> Jamie
> =



int256 has come up a number of times during this review period so I will p=
robably work on that over the next few months. Shouldn't be a large leap f=
rom what is already in here. =



Thank you for taking the time to review!

Matt


-----------------------734da7fd1387bb146e34b17d8c05ec7c
Content-Type: application/pgp-keys; filename="publickey - [email protected] - 0xC1382EAD.asc"; name="publickey - [email protected] - 0xC1382EAD.asc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="publickey - [email protected] - 0xC1382EAD.asc"; name="publickey - [email protected] - 0xC1382EAD.asc"

LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCgp4ak1FWDJ3Z2RCWUpLd1lCQkFI
YVJ3OEJBUWRBVUhPaDBLcGJaQ3N6aGR2S3p0V2o0QzZGUjFvek1CUUUKd2FCaTNtMlBKSExOSzIx
aGRIUkFiV0YwZEdKdmNteGhibVF1WTI5dElEeHRZWFIwUUcxaGRIUmliM0pzCllXNWtMbU52YlQ3
Q2p3UVFGZ29BSUFVQ1gyd2dkQVlMQ1FjSUF3SUVGUWdLQWdRV0FnRUFBaGtCQWhzRApBaDRCQUNF
SkVGbUJXbFZDRmFXbEZpRUV3VGd1clRjb0h3YmRTYklzV1lGYVZVSVZwYVZXdXdFQTc3cm0KT0E0
VEI2WHhlNnE4Z0k0MmJFSUNNaE15WktTTWNha3ozOS9kallrQkFNSk9HK0lHUUMvZDBuM2RzbDEw
CktnL294WDg4a0ZPMW9QS240L1hXK1RvQnpqZ0VYMndnZEJJS0t3WUJCQUdYVlFFRkFRRUhRT3Nt
bzZ3UgpVdVhSQXZGSWlxbVFrellyUHl2S1lLbmEyejRadG1uVFFNa01Bd0VJQjhKNEJCZ1dDQUFK
QlFKZmJDQjAKQWhzTUFDRUpFRm1CV2xWQ0ZhV2xGaUVFd1RndXJUY29Id2JkU2JJc1dZRmFWVUlW
cGFXVUp3RUE1RzBjClpSbkc1V0dORXJJK3k5MGlRclR2MDJpNEl2aHY3dHdvRmNMRC96d0Evakt5
cHcrdmVoRTk5bUVqMS91SQpFa29ERmxOelFacU5sZGJqUmNQeUk1VUgKPTQ2MlMKLS0tLS1FTkQg
UEdQIFBVQkxJQyBLRVkgQkxPQ0stLS0tLQo=
-----------------------734da7fd1387bb146e34b17d8c05ec7c--

--------32ea78406c308eebe4512e96a11c7a09c19d3283e0e2b6efae0181f5b9542308
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: ProtonMail

wroEARYKAG0Fgmpt+uEJEFmBWlVCFaWlRRQAAAAAABwAIHNhbHRAbm90YXRp
b25zLm9wZW5wZ3Bqcy5vcmeXfa+2VAsqT4/DBEkN26e4FaF1oA9n6o1in311
7GWvSRYhBME4Lq03KB8G3UmyLFmBWlVCFaWlAAApOQD45NwKAoAj6QKPOcpk
kWwpFjwVSzlPEPoumTCXg0uHwwD9HRGz2ko/vWetMiO9SOcqpifHdkXlypIs
wTqz+OFVfAA=
=jGqs
-----END PGP SIGNATURE-----


--------32ea78406c308eebe4512e96a11c7a09c19d3283e0e2b6efae0181f5b9542308--


--===============0486387186436158779==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Boost mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://lists.boost.org/mailman3/lists/boost.lists.boost.org/
Archived at: https://lists.boost.org/archives/list/[email protected]/message/NDPMYL4KHS3B6F7TAWFAX5WISR5NI7US/ 

--===============0486387186436158779==--