in reply to bits, vec(), zero, and unpack weirdness

vec works on a string. 0x0 as a string is "0". The ASCII code of this character is 48. There are two nonzero bits in it, bits 4 and 5 (= values 16 and 32 respectively).

Try testing vec on chr(0) instead.