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 );
I want to do this:
//edit don't worry about the hardcoded values, its just to make the example code easier to understand.
However, the compiler informs me that this is forbidden under ISO standards.
How do I achieve this?
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];
Temp1 |= Name[NameCounter];
Just zero out the low byte first. It's easy enough.
Temp1 &= ~0xFF;
Temp1 |= Name[NameCounter];
Temp1 &= ~0xFF;
Temp1 |= Name[NameCounter];
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement