Dark Bit Factory & Gravity
PROGRAMMING => C / C++ /C# => Topic started by: Stonemonkey on May 30, 2007
-
Is there any way to do SAR without resorting to asm?
Cheers,
Fryer.
-
If you're working with signed values it does arithmetic shifts automatically.
ie
#include <stdio.h>
int main(void)
{
int a=0x80000000;
a = a >> 16;
printf("%d %08X\n", a, a);
return 0;
}
gives
-32768 0xFFFF8000
Jim
-
DOH! Thanks Jim.