Skip to main content
8 events
when toggle format what by license comment
Jun 17, 2020 at 9:04 history edited CommunityBot
Commonmark migration
Jul 23, 2014 at 22:17 comment added Level River St ideone behaves exactly like GCC. ideone.com/EpKTpO
Jul 23, 2014 at 8:01 comment added Level River St @Manav indeed it should become zero. As I say, the compiler has a bug. NUM>>i becomes NUM>>(i%64) or equivalently NUM>>(i&63)because the compiler is truncating the leftmost bits of i before performing the bitshift. GCC only considers only the rightmost 6 bits. Visual Studio has the same bug but is slightly better, considering only the rightmost 8 bits NUM>>(i%256). Out of curiosity I will try Ideone when I get home from work.
Jul 23, 2014 at 5:56 comment added manav m-n @steveverrill please explain how NUM>>i changes to NUM>>i%64. Also if a 64-bit number is right shifted more than 64 times it should become zero
Jul 22, 2014 at 20:27 comment added Level River St Indeed, we even have basically the same constant (with bit zero unused and bit 1 representing the number 1.) In C I save a single byte by specifying the constant in hex. I have a 0 for bit zero, I could change it for a 1 like yours for the case i=0. But it never gets displayed anyway.
Jul 22, 2014 at 20:15 comment added Somnium This uses exactly the same principle as mine answer)
Jul 22, 2014 at 20:07 history edited Level River St CC BY-SA 3.0
deleted 1 character in body
Jul 22, 2014 at 20:01 history answered Level River St CC BY-SA 3.0