64-bit field, Big endian encoded
14782
def BE64(value, min_value=None, max_value=None, fuzzable=True, name=None, full_range=False):
    ''''''
    return UInt64(value, min_value=min_value, max_value=max_value, encoder=ENC_INT_BE, fuzzable=fuzzable, name=name, full_range=full_range)
1096319
def u64_to_hex16le(val):
    """"""
    return ''.join("%02x" % (x & 0xFF) for x in (
        val,
        val >> 8,
        val >> 16,
        val >> 24,
        val >> 32,
        val >> 40,
        val >> 48,
        val >> 56,
    ))
1036372
def _long_to_bytes(self, long_value):
        
        _byte_string = b''
        pack = struct.pack
        while long_value > 0:
            _byte_string = pack(b'>I', long_value & 0xffffffff) + _byte_string
            long_value = long_value >> 32
        for i in range(len(_byte_string)):
            if _byte_string[i] != b'\000'[0]:
                break
        else:
            _byte_string = b'\000'
            i = 0
        _byte_string = _byte_string[i:]

        return _byte_string
223223
def big_endian_lengths(bytes)
      lengths = [] # we can't use a hash since the order will be screwed in Ruby 1.8
      lengths << [:options, (bytes.shift << 8) | bytes.shift]                                             # 2 bytes   Length of the "options" field
      lengths << [:id,      (bytes.shift << 8) | bytes.shift]                                             # 2 bytes   Length of the "ID" or "name" field
      lengths << [:type,    (bytes.shift << 8) | bytes.shift]                                             # 2 bytes   Length of the "type" field
      lengths << [:data,    (bytes.shift << 24) | (bytes.shift << 16) | (bytes.shift << 8) | bytes.shift] # 4 bytes   Size of the included file
      lengths
    end
732092
def append_sfixed64(self, value):
        
        sign = (value & 0x8000000000000000) and -1 or 0
        if value >> 64 != sign:
            raise errors.EncodeError('SFixed64 out of range: %d' % value)
        self._stream.append_little_endian64(value & 0xffffffffffffffff)
474844
public void writeInt64(final int fieldNumber, final long value)
                         throws IOException {
    writeTag(fieldNumber, WireFormat.WIRETYPE_VARINT);
    writeInt64NoTag(value);
  }
1102248
def _read_json_binary_field(deserialized, field):
    ''' 
    '''
    val = deserialized.get(field)
    if val is not None:
        return utils.convert_to_bytes(val)
    val = deserialized.get(field + '64')
    if val is None:
        return None
    return utils.raw_urlsafe_b64decode(val)
1123072
public static function bit64(string $data, int $offset = 0, bool $endianness = false): int
    {
        // big-endian
        if (true === $endianness) {
            return unpack('J', $data, $offset)[1];
        }

        // little-endian
        if (false === $endianness) {
            return unpack('P', $data, $offset)[1];
        }

        // machine byte order
        if (null === $endianness) {
            return unpack('Q', $data, $offset)[1];
        }
    }
1142273
public static function bit64(int $data, $endianness = false): string
    {
        // big-endian
        if (true === $endianness) {
            return pack('J', $data);
        }

        // little-endian
        if (false === $endianness) {
            return pack('P', $data);
        }

        // machine byte order
        if (null === $endianness) {
            return pack('Q', $data);
        }
    }
377962
public static void writeLongBigEndian(ByteBuffer io, long value) {
		io.put((byte)((value >> 56) & 0xFF));
		io.put((byte)((value >> 48) & 0xFF));
		io.put((byte)((value >> 40) & 0xFF));
		io.put((byte)((value >> 32) & 0xFF));
		io.put((byte)((value >> 24) & 0xFF));
		io.put((byte)((value >> 16) & 0xFF));
		io.put((byte)((value >> 8) & 0xFF));
		io.put((byte)(value & 0xFF));
	}
999102
public static String encodeFieldData(BaseField field)
    {
        if (field.getData() == null)
            return DBConstants.BLANK;
        ByteArrayOutputStream baOut = new ByteArrayOutputStream();
        DataOutputStream daOut = new DataOutputStream(baOut);
        try {
            field.write(daOut, false);
            daOut.flush();
        } catch (IOException e) {
            e.printStackTrace();
        }
        char[] chOut = Base64.encode(baOut.toByteArray());
        if (chOut == null)
            return DBConstants.BLANK;   // Never
        return new String(chOut);
    }
1255566
def encode_int(v):
    """"""
    if not is_numeric(v) or v < 0 or v >= TT256:
        raise Exception("Integer invalid or out of range: %r" % v)
    return int_to_big_endian(v)
1096132
def field_to_long(value):
        
        if isinstance(value, (int, long)):
            return long(value)
        elif isinstance(value, basestring):
            return bytes_to_long(from_hex(value))
        else:
            return None
327846
def _SafeDecodeBytes(unused_field, value):
    """"""
    try:
        result = base64.urlsafe_b64decode(str(value))
        complete = True
    except TypeError:
        result = value
        complete = False
    return CodecResult(value=result, complete=complete)
807915
public static void writeUnsignedIntegerLittleEndian(byte[] buffer, int offset, long value) {
		buffer[offset++] = (byte)(value & 0xFF);
		buffer[offset++] = (byte)((value >> 8) & 0xFF);
		buffer[offset++] = (byte)((value >> 16) & 0xFF);
		buffer[offset] = (byte)((value >> 24) & 0xFF);
	}
150079
function amf0decString(buf) {
    var sLen = buf.readUInt16BE(1);
    return { len: 3 + sLen, value: buf.toString('utf8', 3, 3 + sLen) }
}
827383
def decode_field(self, field, value):
        
        if isinstance(field, messages.EnumField):
            try:
                return field.type(value)
            except TypeError:
                raise messages.DecodeError(
                    'Invalid enum value "%s"' % (value or ''))

        elif isinstance(field, messages.BytesField):
            try:
                return base64.b64decode(value)
            except (binascii.Error, TypeError) as err:
                raise messages.DecodeError('Base64 decoding error: %s' % err)

        elif isinstance(field, message_types.DateTimeField):
            try:
                return util.decode_datetime(value)
            except ValueError as err:
                raise messages.DecodeError(err)

        elif (isinstance(field, messages.MessageField) and
              issubclass(field.type, messages.Message)):
            return self.__decode_dictionary(field.type, value)

        elif (isinstance(field, messages.FloatField) and
              isinstance(value, (six.integer_types, six.string_types))):
            try:
                return float(value)
            except:  # pylint:disable=bare-except
                pass

        elif (isinstance(field, messages.IntegerField) and
              isinstance(value, six.string_types)):
            try:
                return int(value)
            except:  # pylint:disable=bare-except
                pass

        return value