Xgit v0.1.3 Xgit.Util.NB View Source
Conversion utilities for network byte order handling.
Link to this section Summary
Functions
Parses a sequence of 4 bytes (network byte order) as a signed integer.
Parses a sequence of 2 bytes (network byte order) as an unsigned integer.
Parses a sequence of 4 bytes (network byte order) as an unsigned integer.
Convert a 16-bit integer to a sequence of two bytes in network byte order.
Convert a 32-bit integer to a sequence of four bytes in network byte order.
Link to this section Functions
decode_int32(intbuf) View Source
Parses a sequence of 4 bytes (network byte order) as a signed integer.
Reads the first four bytes from intbuf
and returns {value, buf}
where value is the integer value from the first four bytes at intbuf
and buf
is the remainder of the byte array after those bytes.
decode_uint16(intbuf) View Source
Parses a sequence of 2 bytes (network byte order) as an unsigned integer.
Reads the first four bytes from intbuf
and returns {value, buf}
where value is the unsigned integer value from the first two bytes at intbuf
and buf
is the remainder of the byte array after those bytes.
decode_uint32(intbuf) View Source
Parses a sequence of 4 bytes (network byte order) as an unsigned integer.
Reads the first four bytes from intbuf
and returns {value, buf}
where value is the unsigned integer value from the first four bytes at intbuf
and buf
is the remainder of the byte array after those bytes.
encode_int16(v) View Source
Convert a 16-bit integer to a sequence of two bytes in network byte order.
encode_int32(v) View Source
Convert a 32-bit integer to a sequence of four bytes in network byte order.