| ??? 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! |
| Topic | Author | Date |
| 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 |



