Fix bitmask generation larger than 32 bits.

Fixed #144.