Int128 in .Net?

后端 未结 8 1038
北海茫月
北海茫月 2020-12-01 09:53

I need to do some large integer math. Are there any classes or structs out there that represent a 128-bit integer and implement all of the usual operators?

BTW, I r

8条回答
  •  长情又很酷
    2020-12-01 10:48

    GUID is backed by a 128 bit integer in .NET framework; though it doesn't come with any of the typical integer type methods.

    I've written a handler for GUID before to treat it as a 128 bit integer, but this was for a company I worked for ~8 years ago. I no longer have access to the source code.

    So if you need native support for a 128 bit integer, and don't want to rely on BigInteger for whatever reason, you could probably hack GUID to server your purposes.

提交回复
热议问题