protected void checkBits( long value, long bitMask, boolean signed ) throws IOException {
        if( !signed ) {
            // Simple, see if we've exceeded the bits
            if( value != (value & bitMask) ) {
                error("Number overflow", lastPosition());
            }
        } else if( value > 0 ) {
            // See if the value pops the sign bit or greater      
            long signBits = ~(bitMask >> 1);
            if( (value & signBits) != 0 ) {
                error("Number overflow", lastPosition());
            }
        } else if( value < 0 ) {
            // We try to detect non-sign extension in the sign bits
            // area... which means all of those 1s should be on.            
            long signBits = ~(bitMask >> 1);
            if( (value & signBits) != signBits ) {
                error("Number overflow", lastPosition());
            }
        }        
    }