Read bits and interpret as an unsigned int.
773232
def _readuint(self, length, start):
        """"""
        if not length:
            raise InterpretError("Cannot interpret a zero length bitstring "
                                           "as an integer.")
        offset = self._offset
        startbyte = (start + offset) // 8
        endbyte = (start + offset + length - 1) // 8

        b = binascii.hexlify(bytes(self._datastore.getbyteslice(startbyte, endbyte + 1)))
        assert b
        i = int(b, 16)
        final_bits = 8 - ((start + offset + length) % 8)
        if final_bits != 8:
            i >>= final_bits
        i &= (1 << length) - 1
        return i
836601
public int readInt(int offset, byte[] data)
   {
      int result = 0;
      int i = offset + m_offset;
      for (int shiftBy = 0; shiftBy < 32; shiftBy += 8)
      {
         result |= ((data[i] & 0xff)) << shiftBy;
         ++i;
      }
      return result;
   }
790830
def read_int16(self, little_endian=True):
        
        if little_endian:
            endian = "<"
        else:
            endian = ">"
        return self.unpack('%sh' % endian, 2)
913607
def read_uint8(self, little_endian=True):
        
        if little_endian:
            endian = "<"
        else:
            endian = ">"
        return self.unpack('%sB' % endian)
1001499
def read_byte_as_integer(bytelen)
      unless bit_pointer % 8 == 0
        raise BinaryException.new("Bit pointer must be pointing start of byte. " +
                                  "But now pointing #{bit_pointer}.")
      end
      if self.length - bit_pointer/8 < bytelen
        raise BinaryException.new("Rest of self length(#{self.length - bit_pointer/8}byte) " + 
                                  "is shorter than specified byte length(#{bytelen}byte).")
      end
      response = 0
      bytelen.times do |i|
        response = response << 8
        response += to_i(bit_pointer/8 + i)
      end
      bit_pointer_inc(bytelen * 8)
      return response
    end
665805
def read_discrete_inputs(addr, ninputs)
      query("\x2" + addr.to_word + ninputs.to_word).unpack_bits[0..ninputs-1]
    end
1057972
public static int readInt(byte[] array, int offset) {
    // First make integers to resolve signed vs. unsigned issues.
    int b0 = array[offset + 0] & 0xFF;
    int b1 = array[offset + 1] & 0xFF;
    int b2 = array[offset + 2] & 0xFF;
    int b3 = array[offset + 3] & 0xFF;
    return ((b0 << 24) + (b1 << 16) + (b2 << 8) + (b3 << 0));
  }
369963
def read_unsigned_byte(self, cmd):
        
        result = self.bus.read_byte_data(self.address, cmd)
        self.log.debug(
            "read_unsigned_byte: Read 0x%02X from command register 0x%02X" % (
                result, cmd
            )
        )
        return result
1164883
private int readUnsignedVarInt() throws IOException {
    int value = 0;
    int shift = 0;
    int b;
    do {
      b = in.read();
      value |= (b & 0x7F) << shift;
      shift += 7;
    } while ((b & 0x80) != 0);
    return value;
  }
803665
def read_long(self):
        """"""
        self.bitcount = self.bits = 0
        return unpack('>I', self.input.read(4))[0]
149941
def _unsigned_to_signed(v, bits):
        
        if StridedInterval._is_msb_zero(v, bits):
            return v
        else:
            return -(2 ** bits - v)
1126464
private long read32(byte[] buffer, int offset) {
        byte b0 = buffer[offset];
        byte b1 = buffer[offset + 1];
        byte b2 = buffer[offset + 2];
        byte b3 = buffer[offset + 3];

        // convert signed bytes to unsigned values
        int i0 = ((b0 & 0x80) == 0x80 ? (b0 & 0x7F) + 0x80 : b0);
        int i1 = ((b1 & 0x80) == 0x80 ? (b1 & 0x7F) + 0x80 : b1);
        int i2 = ((b2 & 0x80) == 0x80 ? (b2 & 0x7F) + 0x80 : b2);
        int i3 = ((b3 & 0x80) == 0x80 ? (b3 & 0x7F) + 0x80 : b3);

        return ((long) i0 << 24) + ((long) i1 << 16) + ((long) i2 << 8) + (long) i3;
    }
552905
def int_subtype(i, bits, signed) :
        ""
        if not isinstance(i, int) :
            raise TypeError("value is not int: %s" % repr(i))
        #end if
        if signed :
            lo = - 1 << bits - 1
            hi = (1 << bits - 1) - 1
        else :
            lo = 0
            hi = (1 << bits) - 1
        #end if
        if i < lo or i > hi :
            raise ValueError \
              (
                "%d not in range of %s %d-bit value" % (i, ("unsigned", "signed")[signed], bits)
              )
        #end if
        return \
            i
1317998
def read_uint64(self, little_endian=True):
        
        if little_endian:
            endian = "<"
        else:
            endian = ">"
        return self.unpack('%sQ' % endian, 8)
453368
public int decodeNBitUnsignedInteger(int n) throws IOException {
		assert (n >= 0);

		int bitsRead = 0;
		int result = 0;

		while (bitsRead < n) {
			// result = (result << 8) | is.read();
			result += (decode() << bitsRead);
			bitsRead += 8;
		}
		return result;
	}
752563
public Bits read(final int bits) throws IOException {
    final int additionalBitsNeeded = bits - this.remainder.bitLength;
    final int additionalBytesNeeded = (int) Math.ceil(additionalBitsNeeded / 8.);
    if (additionalBytesNeeded > 0) this.readAhead(additionalBytesNeeded);
    final Bits readBits = this.remainder.range(0, bits);
    this.remainder = this.remainder.range(bits);
    return readBits;
  }
1050340
static long readBits(ReadStream reader, int count) {
		long bits = 0L;
		for (int i = (count - 1) >> 3; i >= 0; i --) {
			bits <<= 8;
			bits |= reader.readByte() & 0xff;
		}
		return bits;
	}