Emulating a hardware signed multiplier
Torbjorn Granlund
tg at gmplib.org
Sun Oct 25 09:11:38 CET 2009
Sorry, my previous advice about signed long long was not very clever.
The hardware multiplier takes two signed 64-bit numbers and produces a
signed 128-bit number. I'm new to GMP and I'm looking for a way to
make it interpret numbers the same way the hardware multiplier does.
That might be hard. GMP stores negative numbers not in two's complement
form, but in sign+magnitude form. But if you generate numbers in the
range -2^63 ... 2^63-1 then GMP and your hardware should agree on the
result since that always fits a 128-bit two's complement number.
Exactly how to program things is something I cannot help with.
--
Torbjörn
More information about the gmp-discuss
mailing list