Sign in to follow this  

LOBYTE

This topic is 3661 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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];

Share this post


Link to post
Share on other sites

This topic is 3661 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this