Upper 32 bits (off topic)

Search this archive.

From: Jay Link (jlink@interlink-bbs.com)
Date: Fri 10 Mar 2000 - 17:40:36 IST


This is somewhat off-topic, but I figure if anyone can answer it, you guys
can. Thanks.

==========

Ok, you smart guys, how do I get the upper 32 bits of a number when using
a 32-bit compiler? I.e., >> 32 would work on a 64-bit system, but you
can't do that on an x86, right?

Here's an example using a "Watcom" compiler:

/*------------------------------------------------------------------------*
  BIGMUL -> 32bit * 32bit = 64bit. We need the upper 32 bit.
            On a 64-bit compiler, it would be (num1 * num2) >> 32;
 *------------------------------------------------------------------------*/
int BIGMUL(int a, int b);
#pragma aux BIGMUL = \
  "imul  edx"        \
  parm [eax] [edx]   \
  value [edx];


How I rewrite this for gcc?

Thanks!

-Jay


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:23 IST