bight

Procs

func readI16BE(b: openArray[byte]): int16 {....raises: [], tags: [].}
Read an int16 in big-endian order from a byte array.
func readI16BE(p: pointer): int16 {....raises: [], tags: [].}

Read an int16 in big-endian order from a memory location specified by a pointer.

Note: all pointer operations are unsafe. This proc will read 2 bytes from the provided pointer.

func readI16LE(b: openArray[byte]): int16 {....raises: [], tags: [].}
Read an int16 in little-endian order from a byte array.
func readI16LE(p: pointer): int16 {....raises: [], tags: [].}

Read an int16 in little-endian order from a memory location specified by a pointer.

Note: all pointer operations are unsafe. This proc will read 2 bytes from the provided pointer.

func readI32BE(b: openArray[byte]): int32 {....raises: [], tags: [].}
Read an int32 in big-endian order from a byte array.
func readI32BE(p: pointer): int32 {....raises: [], tags: [].}

Read an int32 in big-endian order from a memory location specified by a pointer.

Note: all pointer operations are unsafe. This proc will read 4 bytes from the provided pointer.

func readI32LE(b: openArray[byte]): int32 {....raises: [], tags: [].}
Read an int32 in little-endian order from a byte array.
func readI32LE(p: pointer): int32 {....raises: [], tags: [].}

Read an int32 in little-endian order from a memory location specified by a pointer.

Note: all pointer operations are unsafe. This proc will read 4 bytes from the provided pointer.

func readI64BE(b: openArray[byte]): int64 {....raises: [], tags: [].}
Read an int64 in big-endian order from a byte array.
func readI64BE(p: pointer): int64 {....raises: [], tags: [].}

Read an int64 in big-endian order from a memory location specified by a pointer.

Note: all pointer operations are unsafe. This proc will read 8 bytes from the provided pointer.

func readI64LE(b: openArray[byte]): int64 {....raises: [], tags: [].}
Read an int64 in little-endian order from a byte array.
func readI64LE(p: pointer): int64 {....raises: [], tags: [].}

Read an int64 in little-endian order from a memory location specified by a pointer.

Note: all pointer operations are unsafe. This proc will read 8 bytes from the provided pointer.

func readU16BE(b: openArray[byte]): uint16 {....raises: [], tags: [].}
Read a uint16 in big-endian order from a byte array.
func readU16BE(p: pointer): uint16 {....raises: [], tags: [].}

Read a uint16 in big-endian order from a memory location specified by a pointer.

Note: all pointer operations are unsafe. This proc will read 2 bytes from the provided pointer.

func readU16LE(b: openArray[byte]): uint16 {....raises: [], tags: [].}
Read a uint16 in little-endian order from a byte array.
func readU16LE(p: pointer): uint16 {....raises: [], tags: [].}

Read a uint16 in little-endian order from a memory location specified by a pointer.

Note: all pointer operations are unsafe. This proc will read 2 bytes from the provided pointer.

func readU32BE(b: openArray[byte]): uint32 {....raises: [], tags: [].}
Read a uint32 in big-endian order from a byte array.
func readU32BE(p: pointer): uint32 {....raises: [], tags: [].}

Read a uint32 in big-endian order from a memory location specified by a pointer.

Note: all pointer operations are unsafe. This proc will read 4 bytes from the provided pointer.

func readU32LE(b: openArray[byte]): uint32 {....raises: [], tags: [].}
Read a uint32 in little-endian order from a byte array.
func readU32LE(p: pointer): uint32 {....raises: [], tags: [].}

Read a uint32 in little-endian order from a memory location specified by a pointer.

Note: all pointer operations are unsafe. This proc will read 4 bytes from the provided pointer.

func readU64BE(b: openArray[byte]): uint64 {....raises: [], tags: [].}
Read a uint64 in big-endian order from a byte array.
func readU64BE(p: pointer): uint64 {....raises: [], tags: [].}

Read a uint64 in big-endian order from a memory location specified by a pointer.

Note: all pointer operations are unsafe. This proc will read 8 bytes from the provided pointer.

func readU64LE(b: openArray[byte]): uint64 {....raises: [], tags: [].}
Read a uint64 in little-endian order from a byte array.
func readU64LE(p: pointer): uint64 {....raises: [], tags: [].}

Read a uint64 in little-endian order from a memory location specified by a pointer.

Note: all pointer operations are unsafe. This proc will read 8 bytes from the provided pointer.

func toBytesBE[T: SomeInteger](x: T): array[sizeof(x), byte]

Encode given integers as an array of bytes in big-endian order.

Returns an array of sizeof(x) bytes.

func toBytesLE[T: SomeInteger](x: T): array[sizeof(x), byte]

Encode given integers as an array of bytes in little-endian order.

Returns an array of sizeof(x) bytes.

proc writeBytesBE[T: SomeInteger](x: T; dst: pointer)

Write the given integer as bytes in big-endian order to a memory location specified by a pointer.

Note: All pointer operations are unsafe. This proc will write sizeof(x) bytes in memory at the location specified by the dst pointer.

proc writeBytesBE[T: SomeInteger](x: T; dst: var openArray[byte])
Write the given integer as bytes in big-endian order to the byte array dst.
proc writeBytesLE[T: SomeInteger](x: T; dst: pointer)

Write the given integer as bytes in little-endian order to a memory location specified by a pointer.

Note: All pointer operations are unsafe. This proc will write sizeof(x) bytes in memory at the location specified by the dst pointer.

proc writeBytesLE[T: SomeInteger](x: T; dst: var openArray[byte])
Write the given integer as bytes in little-endian order to the byte array dst.