/* turn on all bits before word */
const unsigned short ones_mask = 0xFFFF << ws;
warning: The result of the '<<' expression is undefined
const unsigned short ones_mask = 0xFFFF << ws;
~~~~~~~^~~~~~~~~~~~~~~~~~~~
1 warning generated.
Нужно городить switch-case или for?