Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/05/04 09:35
Read: times


 
#75456 - RE: Help with intrins function Keil V7.09
Responding to: ???'s previous message

char rotate_r(char val)
{
char a;
a= val>>1;
if (val & 0x01) // is the lsb ==1
{
a |= 0x80; //yep, pop it into the msb
}
return a;
}

Russell,
you rotate signed char in your function. Is it what you wanted?
I suppose that correct way is:
unsigned char rotate_r(unsigned char val) 
{ 
 unsigned char a; 
  a= val>>1; 
  if (val & 0x01) // is the lsb ==1 
  { 
    a |= 0x80; //yep, pop it into the msb 
  } 
  return a; 
} 


Vaclav

List of 9 messages in thread
TopicAuthorDate
Help with intrins function Keil V7.09            01/01/70 00:00      
   RE:Help with intrins function Keil V7.09            01/01/70 00:00      
   RE: Help with intrins function Keil V7.09            01/01/70 00:00      
      RE: Help with intrins function Keil V7.09            01/01/70 00:00      
         RE: Help with intrins function Keil V7.09            01/01/70 00:00      
            RE: Help with intrins function Keil V7.09            01/01/70 00:00      
               RE: Help with intrins function Keil V7.09            01/01/70 00:00      
            RE: Help with intrins function Keil V7.09            01/01/70 00:00      
   RE: Help with intrins function Keil V7.09            01/01/70 00:00      

Back to Subject List