Check a value fits in the given number of bits

valid_encoded_value(x, nbits)

Arguments

x

value. integer, or something which can be corerced to integer

nbits

number of bits in which to fit 'x'