I see this in code now and then:

                1<<16-1

Python and C interpret that as "1 << (16 - 1)", which is 32768.

The programmer usually means "(1 << 16) - 1", which is 65535.

There's a big difference, especially if you are using these for bit masks:

32768 = 1000000000000000
65535 = 1111111111111111

Tom
_______________________________________________
Tech mailing list
Tech@lopsa.org
http://lopsa.org/cgi-bin/mailman/listinfo/tech
This list provided by the League of Professional System Administrators
 http://lopsa.org/

Reply via email to