S
Spoon
Hello,
The typedef name uint8_t designates an unsigned integer type
with width exactly 8. (I am only interested in platforms where
uint8_t is defined.)
Are the two following code fragments equivalent on every
platform where uint8_t is defined?
int u = something;
uint8_t buf[100];
buf[66] = u;
vs
int u = something;
uint8_t buf[100];
buf[66] = u & 0xff;
Similarly, are the two following statements equivalent?
buf[66] = u >> 8;
vs
buf[66] = (u >> 8) & 0xff;
Is there any difference if u is of type long int?
What if u is of an unsigned type?
Regards.
The typedef name uint8_t designates an unsigned integer type
with width exactly 8. (I am only interested in platforms where
uint8_t is defined.)
Are the two following code fragments equivalent on every
platform where uint8_t is defined?
int u = something;
uint8_t buf[100];
buf[66] = u;
vs
int u = something;
uint8_t buf[100];
buf[66] = u & 0xff;
Similarly, are the two following statements equivalent?
buf[66] = u >> 8;
vs
buf[66] = (u >> 8) & 0xff;
Is there any difference if u is of type long int?
What if u is of an unsigned type?
Regards.