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

Depends how left shift is implemented: on some processors (including x86), only the lowest order bits of the number of positions to shift by are used. In Java:

char A = 1; A = ((char) ((A << 32) & 0xFFFF)); System.out.println(Integer.toHexString(A));

actually outputs 1.



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

Search: