128 bit signed and unsigned integer types

Miles _______ at _______.____
Sun Dec 28 11:17:03 PST 2008


Walter Bright wrote:
> You know, the unimplemented 128 bit integer types.
> Does anyone have a use for these?

In distributed systems, *a lot*.

1. In network programming, IPv6 addresses are becoming very common
(nobody should ever think about writing a network-enabled application
without native IPv6 support nowadays). IPv6 addresses are 128-bit. No
arithmetic is needed, just copy, comparison and bitwise, masking and
bitshift operations.

2. Also, UUIDs[1] and other similar universal identification schemes are
very common, we use them all the time in distributed systems. They are
128-bit numbers, only copy, comparison and bitwise operations are needed.

3. In cryptography, also very common in distributed systems, it is
common to have symmetric ciphers with key sizes of 128 and 256-bits. We
currently have to break the cypher blocks in peaces and move a lot of
the complexity up to the algorithm level in order to process such data
in 32 or 64-bit registers and variables. It would be great if
cryptographers could trust compilers to do this in the lower level
(properly using SSE registers and so).

In all these cases, bigints are completely inadequate. I currently have
to use (for the first two cases) a struct with operators implemented in
asm (with different versions for x86 and x64) for efficient manipulation
of these numbers. All this in C and C++.


[1] http://en.wikipedia.org/wiki/Universally_Unique_Identifier



More information about the Digitalmars-d mailing list