Help stabilising mini-gmp
Torbjörn Granlund
tg at gmplib.org
Fri Nov 25 17:39:28 UTC 2016
Marc Glisse <marc.glisse at inria.fr> writes:
Surprisingly, shifting negative numbers left is undefined, while
shifting them right it implementation-defined.
I fail to appreciate the difference between these definitions of
undefinedness.
I assume "undefined" means that the computer will not explode, or even
cause any less dramatic security issues, or even terminate execution.
It's undefined only in that the result can be any bit pattern. This bit
pattern might vary bewteen any two computers, with used compiler and
between two executions.
And "implementation-defined" means that the bit pattern can be anything,
varying between computers (or compiler on one computer).
So it seems the only difference is that "implementation-defined" means
that two executions (compiled in the same way on a given computer) will
yield the same arbitrary bit pattern. How useful. :-)
--
Torbjörn
Please encrypt, key id 0xC8601622
More information about the gmp-devel
mailing list