Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

a = 1111 0000 0000 1111 1111 0000 0000 1111

a << 37 == a << (37 % 32) == a << 5 == 0000 0001 1111 1110 0000 0001 1110 0000

a >> (32 - (37 % 32)) == a >> 27 == 0000 0000 0000 0000 0000 0000 0001 1110

anding the two together you get == 0000 0001 1111 1110 0000 0001 1111 1110

which is a circular rotation of the bit string...



0 & 1 is not 1, it's 0.

      0000 0001 1111 1110 0000 0001 1110 0000
    & 0000 0000 0000 0000 0000 0000 0001 1110
    -----------------------------------------
      0000 0000 0000 0000 0000 0000 0000 0000


You're right! My bad. Definitely meant to | it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: