Is there any specific reason for preferring

1<<(i & 0x1F) over 1<< ¡

Where let i =5

As both will give same answer ?

If you let i = 5 then it doesn’t matter what you use as both will give same answer.

In fact for numbers less than 32 both these will give you the same answer.

But, see what (i & 0x1F) does to numbers greater than 31.

Consider i = 32:

- 1 << i will give you
**4294967296**which is pow(2, 32) - But in the other one (i & 0x1F) will result to 0 and hence 1 << (i & 0x1F) will give you
**1**

what (i & 0x1F) does here is that it reduces i to its the last 5 bits (eg: 54 will be reduced to 22) which results in different answers for numbers greater than 31.

Hope this helps.