use MAX_VALUE_BYTE and MAX_VALUE_WORD instead of 256 and 65536.
merge merge of master from toad.
FIX: max value is one less than the number of values encodable by a given data structure!