LOBYTE

Started by
2 comments, last by _Sigma 16 years, 4 months ago
I want to do this: //edit don't worry about the hardcoded values, its just to make the example code easier to understand.

  int NameLen; 
  int Temp1; 
  signed int NameResult; 
  signed int NameCounter; 
  char* Name = "_Sigma";

     NameCounter = 6;
     NameResult = 0;
     Temp1 = 0;

     do
     {
         //change the lowbyte in temp1 to be the character from name
         LOBYTE(Temp1) = Name[NameCounter];
         NameResult += Temp1 + 85;
         --NameCounter;
     }
     while ( NameCounter );


However, the compiler informs me that this is forbidden under ISO standards. How do I achieve this?
Advertisement
If you only want to change the low byte and not any other part of Temp1 and you know that Name[NameCounter] is zero everywhere outside of the low byte, then you can just do

Temp1 |= Name[NameCounter];
Just zero out the low byte first. It's easy enough.

Temp1 &= ~0xFF;
Temp1 |= Name[NameCounter];
cool. thanks :)

This topic is closed to new replies.

Advertisement