i declared a variable mask of int type, then do some and mask updated by mask >>= 1 , and i got BUS error(I don’t know what the hell is this) on my code then i changed mask /= 2 and code got AC o.O . can anyone suggest why this is happned?
The minions are actively looking into your issue. Just sit back and relax. They will get back to you.
Anshuman Singh ok and thnx
Paras Meena Hm, so this is interesting. The int mask = (1<<31) is not a positive number. Instead, this way you end up setting the sign bit, and your corresponding number is -2147483648.
If I run a loop where in each iteration, I do mask >>= 1, following are the mask values, if the starting value was (1<<31) :
and -1 goes on infinitely.
However, when doing mask /= 2, mask becomes 0 right after -1.
Doing an unsigned mask = (1 << 31) works.
Anshuman Singh OMG Sorry for bothering you. by the way srsly nice work (y)