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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/21/03 09:12
Read: times


 
#53011 - RE: byte and int in C
Responding to: ???'s previous message
Yes,
as well there is another fast way but you need know the format of bytes in memory - is it either Big or Little Endian, for example:
unsigned int x;

{
unsigned char low, high;

low = ((unsigned char *)&x)[0];
high = ((unsigned char *)&x)[1];
}

This way does not do any calculations but just pointer types` conversion which is the part of compiler -> no processor power is involved.
Good days!

List of 7 messages in thread
TopicAuthorDate
byte and int in C            01/01/70 00:00      
   RE: byte and int in C            01/01/70 00:00      
      RE: byte and int in C            01/01/70 00:00      
   RE: byte and int in C            01/01/70 00:00      
      RE: byte and int in C            01/01/70 00:00      
         RE: byte and int in C            01/01/70 00:00      
            RE: byte and int in C            01/01/70 00:00      

Back to Subject List