Re: (x * x) % y

New Message Reply About this list Date view Thread view Subject view Author view

Enzo Michelangeli (em@who.net)
Sat, 24 Apr 1999 07:49:42 +0800


-----Original Message-----
From: Ben Laurie <ben@algroup.co.uk>
To: Enzo Michelangeli <em@who.net>
Cc: Olivier Langlois <olanglois@sympatico.ca>; Derek Atkins
<warlord@MIT.EDU>; CodherPlunks@toad.com <CodherPlunks@toad.com>
Date: Friday, April 23, 1999 9:20 PM
Subject: Re: (x * x) % y

[...]
>Isn't this exactly the same (broken) code he is trying to avoid? You've
>said "do a 32-bit multiply and widen _the result_ to 64 bit", which gets
>you nowhere (and is why the resulting code is "tight", no doubt).
>
>The one line equivalent of what you wrote is "(__int64)(i*i)%j", which
>is not the same as "((__int64)i*i)%j".

Uhm, I see. And, on the other hand,

unsigned test( unsigned i, unsigned j )
{
   __int64 ii;
   ii = i;
   ii *= i;
   return (ii%j);
}

...again produces the lame code with calls to __allmul and __allrem.

Well, it looks like Microsoft's support for 64-bit integers has room for
improvements...

Cheers --

Enzo


New Message Reply About this list Date view Thread view Subject view Author view

 
All trademarks and copyrights are the property of their respective owners.

Other Directory Sites: SeekWonder | Directory Owners Forum

The following archive was created by hippie-mail 7.98617-22 on Thu May 27 1999 - 23:44:22