P
Philip S
Hi,
Forgive me for not searching the entire newsgroup, should this question
already have been answered..
I can't find the logic in why this example doesn't work:
unsigned short* res_16;
unsigned short* pu_16;
unsigned short u_16;
pu_16 = 0x0u;
u_16 = 0x0u;
res_16 = (pu_16 + 0x555u);
The above code yields res_16 == 0xAAA.
I was sort of hoping for 0x555 instead...
Altering the addition line to this:
res_16 = (unsigned short*)(u_16 + 0x555);
corrects the problem...
why?
The platform is a 32bit Intel.
Trying to decipher the addition, I get:
1) 32bit_u = (32bit_u + 32bit_u)
2) 32bit_u = (32bit_u)(16bit_u + 32bit_u)
assuming that the pointer "unsigned short *" is 32bit...
- Philip
Forgive me for not searching the entire newsgroup, should this question
already have been answered..
I can't find the logic in why this example doesn't work:
unsigned short* res_16;
unsigned short* pu_16;
unsigned short u_16;
pu_16 = 0x0u;
u_16 = 0x0u;
res_16 = (pu_16 + 0x555u);
The above code yields res_16 == 0xAAA.
I was sort of hoping for 0x555 instead...
Altering the addition line to this:
res_16 = (unsigned short*)(u_16 + 0x555);
corrects the problem...
why?
The platform is a 32bit Intel.
Trying to decipher the addition, I get:
1) 32bit_u = (32bit_u + 32bit_u)
2) 32bit_u = (32bit_u)(16bit_u + 32bit_u)
assuming that the pointer "unsigned short *" is 32bit...
- Philip