> I understand how you can define a ROTL as
> 
> #define ROTL(x,y) (((x)<<(y&(w-1))) | ((x)>>(w-(y&(w-1)))))
> 
> where w is the number of bits in x and y. But why does this only work
> with unsigned numbers and not signed?

  this one i can answer! :P

  a shift right ">>" works the way you intend if the number is 
  unsigned.. however, if you have a negative number, the shifting
  works slightly different.

  -32 >> 1 should give you -16 right? and what does this tell
  you just by looking at it? *the* SIGN bit is maintained, and
  hence the MSB is not removed :>

> More importantly, isn't there a built-in hardware instruction to
> do this in the Motorola 68K chips? and how do we put in-line
> assembly into our Palm programs?

  asm ("rol.b d0");

  or something like that :>

az. 
--
Aaron Ardiri 
Java Certified Programmer      http://www.hig.se/~ardiri/
University-College i G�vle     mailto:[EMAIL PROTECTED]
SE 801 76 G�vle SWEDEN       
Tel: +46 26 64 87 38           Fax: +46 26 64 87 88
Mob: +46 70 656 1143           A/H: +46 8 668 78 72

if you enjoy it, then it aint work :) - rule #106 of life


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to