问题描述
在C ++中表示128位数字的最好方法是什么?它应该尽可能接近内置的数字类型(即支持所有的算术运算符,等等)。
What's the best way to represent a 128-bit number in C++? It should behave as closely to the built-in numeric types as possible (i.e. support all the arithmetic operators, etc).
我正在考虑构建一个类有2 64位或4 32位数。或者可能只是创建一个128位的内存块,并自己做一些事情。
I was thinking of building a class that had 2 64 bit or 4 32 bit numbers. Or possibly just creating a 128 bit block of memory and doing everything myself.
有一些更容易/更标准的方式,当自己实现它? :)
Is there some easier/more standard way, or something that I'm less likely to screw up when implementing it myself? :)
如果它可以扩展为256位,512位等,也会很好。
It would also be nice if it could be extended to 256-bit, 512-bit, etc...
推荐答案
查看已开发的其他库。很多人都想在你面前这样做。 :D
Look into other libraries that have been developed. Lots of people have wanted to do this before you. :D
尝试
这篇关于在C ++中表示128位数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!