Emulating a hardware signed multiplier
borge.strand at gmail.com
Sun Oct 25 10:40:42 CET 2009
I came to the same conclusion. I'll have a go at it after our
one-year-old is put to bed tonight :-)
I'll use GMP for other purposes than this, so I guess I'll rather
spend time tweaking it than learning the correct X86 assembly
instructions and their interface. Not state of the art programming, I
know, but it's probably what gets me there in the least (human) time.
On Sun, Oct 25, 2009 at 10:11, Torbjorn Granlund <tg at gmplib.org> wrote:
> 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.
More information about the gmp-discuss