msb function and perhaps make putBit work