> uint32_t  t1;
> int main(){
> t1=0xf << (12);    // t1 gets fffff000 instead of 0000f000
> }

try

t1 = ((uint32_t)0xF) << 12;

preprocessor uses int (==int16) by default so
0xf << 12 == 0xf000;

then it converts the result to uint32.
and You have the result :)
-- 

. ''`.                               Dmitry E. Oboukhov
: :’  :   email: un...@debian.org jabber://un...@uvw.ru
`. `~’              GPGKey: 1024D / F8E26537 2006-11-21
  `- 1B23 D4F8 8EC0 D902 0555  E438 AB8C 00CF F8E2 6537

Attachment: signature.asc
Description: Digital signature

_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to