Possible Duplicate:
Int128 in .Net?
as I'm working on a tool which manages IP devices and I'd like to add IPv6 Support to it, I'm searching for a 128bit unsigned Integer .net Datatype to do basic IP related calculations (Subnetting, List all Hosts for a Subnet, ..)
It should support the standard arithmetic/logic methods.
Thank you :)
DrinkMoreBoilingWater's blog. As an extension the integer scalar type __int128 is supported for targets which have an integer mode wide enough to hold 128 bits. Simply write __int128 for a signed 128-bit integer, or unsigned __int128 for an unsigned 128-bit integer.
An Int128 is the "natural" type of GUID, IP6 addresses and more at low level but nevertheless true x86 instruction CPUID returns 4 integers (in 4 registers) that need to be "concatenated" to get the real value, the real "intent" was to return an Int128.
The 128-bit data type can handle up to 31 significant digits (compared to 17 handled by the 64-bit long double). However, while this data type can store numbers with more precision than the 64-bit data type, it does not store numbers of greater magnitude.
The int128 type defines a signed 128-bit integer. The API is meant to mimic an intrinsic integer type as closely as possible, so that any forthcoming int128_t can be a drop-in replacement. The int128 type supports the following: Implicit conversion from signed integral types and unsigned types narrower than 128 bits.
in this article the author describes and shows how to implement the Int128 datatype in .NET: http://www.informit.com/guides/content.aspx?g=dotnet&seqNum=636
also please search here in SO before posting :)
Int128 in .Net?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With