Pack integers into hex string.

    Use little-endian and unsigned int format.
339958
def fw_int_to_hex(*args):
    
    return binascii.hexlify(
        struct.pack('<{}H'.format(len(args)), *args)).decode('utf-8')
1188922
def _convert_hex_str_to_int(val):
    """"""
    if val is None:
        return None

    hex_num = int(val, 16)
    #  ensure it fits into 64-bit
    if hex_num > 0x7FFFFFFFFFFFFFFF:
        hex_num -= 0x10000000000000000

    assert -9223372036854775808 <= hex_num <= 9223372036854775807
    return hex_num
57681
def read_int8(self, little_endian=True):
        
        if little_endian:
            endian = "<"
        else:
            endian = ">"
        return self.unpack('%sb' % endian)
462205
def _unpack_from(buf, format_s, count=None, little_endian=True):
    """"""

    if count is not None:
        assert count > 0
        format_s = '%i%s' % (count, format_s)

    if little_endian is True:
        format_s = '<' + format_s
    else:
        format_s = '>' + format_s

    size = struct.calcsize(format_s)
    res = struct.unpack_from(format_s, buf.read(size))

    if count is not None:
        return res
    else:
        return res[0]
222230
def hex16_to_u64be(data):
    """"""
    return int(data[14:16] + data[12:14] + data[10:12] + data[8:10] + data[6:8] + data[4:6] + data[2:4] + data[0:2], 16)
120375
function (hexString) {
    if (hexString.slice(0, 2) === '0x') {
      hexString = hexString.slice(2)
    }
    var integers = []
    for (var i = 0; i < hexString.length; i += 2) {
      integers.push(parseInt(hexString.slice(i, i + 2), 16))
    }
    return integers
  }
560896
public static String toHexLower(byte[] b, int off, int len) {
		return toHex(b, off, len, HEX_LOWER_CHAR);
	}
900269
def int_to_bytes(i, minlen=1, order='big'):  # pragma: no cover
        """"""
        blen = max(minlen, PGPObject.int_byte_len(i), 1)

        if six.PY2:
            r = iter(_ * 8 for _ in (range(blen) if order == 'little' else range(blen - 1, -1, -1)))
            return bytes(bytearray((i >> c) & 0xff for c in r))

        return i.to_bytes(blen, order)
1274312
protected String convertToHex(int i) {

        String hexString = Integer.toHexString(i);
        while (hexString.length() < 2) {
            hexString = "0" + hexString;
        }
        return hexString;
    }
741715
def write_uint64(self, value, little_endian=True):
        
        if little_endian:
            endian = "<"
        else:
            endian = ">"
        return self.pack('%sQ' % endian, value)
146459
def _encode_int(name, value, dummy0, dummy1):
    """"""
    if -2147483648 <= value <= 2147483647:
        return b"\x10" + name + _PACK_INT(value)
    else:
        try:
            return b"\x12" + name + _PACK_LONG(value)
        except struct.error:
            raise OverflowError("BSON can only handle up to 8-byte ints")
949798
def pack_bits( longbits ):
    """"""
    byte = longbits & (0x0101010101010101)
    byte = (byte | (byte>>7)) & (0x0003000300030003)
    byte = (byte | (byte>>14)) & (0x0000000f0000000f)
    byte = (byte | (byte>>28)) & (0x00000000000000ff)
    return byte
698086
def pack_int(v):
    
    if v == 0:
        return "\0"
    ret = ''
    while v > 0:
        c = v & 127
        v >>= 7
        if v != 0:
            c = c | 128
        ret += chr(c)
    return ret
284514
def inttoLEB128(intinput):
    '''
    
    '''

    binstr = str(bin(intinput)) \
             .lstrip("0b").replace("b","").replace("L","") \
             .replace("'","").replace('"',"")
    if len(binstr) % 7:
        binstr = binstr.zfill(len(binstr) + 7 - (len(binstr) % 7))
    bytelist = ""
    for i in range(len(binstr) // 7):
        if i < ((len(binstr) // 7) - 1):
            pad = "1"
        else:
            pad = "0"
        currbyte = binstr[(len(binstr) - (7*i + 7)):(len(binstr) - (7*i))]
        currbyte = pad + currbyte
        currbyte = dechex(int(currbyte,2))
        # assert len(currbyte) == 2
        bytelist = bytelist + currbyte
    return bytelist
678859
def _scaled_int(s):
    """
    s = bytearray(s)  # For Python 2

    # Get leftmost bit (sign) as 1 (if 0) or -1 (if 1)
    sign = 1 - ((s[0] & 0x80) >> 6)

    # Combine remaining bits
    int_val = (((s[0] & 0x7f) << 16) | (s[1] << 8) | s[2])
    log.debug('Source: %s Int: %x Sign: %d', ' '.join(hex(c) for c in s), int_val, sign)

    # Return scaled and with proper sign
    return (sign * int_val) / 10000.
920729
def to_hex_string(data):
    '''  '''
    if isinstance(data, int):
        return '%02X' % data
    return ':'.join([('%02X' % o) for o in data])
1131992
private static String unsignedToString(int value) {
        if (value >= 0) {
            return Integer.toString(value);
        } else {
            return Long.toString((value) & 0x00000000FFFFFFFFL);
        }
    }