ntoh

ntoh(x)

Converts the endianness of a value from Network byte order (big-endian) to that used by the Host.

Examples

ntoh(x::UInt8) -> UInt8

Converts the endianness of a value from Network byte order (big-endian) to that used by the Host.

julia> ntoh(UInt8(0x12))
0x12

This example shows how to convert a single-byte value from network byte order to host byte order.

ntoh(x::UInt16) -> UInt16

Converts the endianness of a value from Network byte order (big-endian) to that used by the Host.

julia> ntoh(UInt16(0x1234))
0x3412

This example demonstrates the conversion of a two-byte value from network byte order to host byte order.

ntoh(x::UInt32) -> UInt32

Converts the endianness of a value from Network byte order (big-endian) to that used by the Host.

julia> ntoh(UInt32(0x12345678))
0x78563412

This example showcases the conversion of a four-byte value from network byte order to host byte order.

ntoh(x::UInt64) -> UInt64

Converts the endianness of a value from Network byte order (big-endian) to that used by the Host.

julia> ntoh(UInt64(0x1234567890ABCDEF))
0xEFCDAB9078563412

This example illustrates the conversion of an eight-byte value from network byte order to host byte order.

Note: The ntoh function is applicable to unsigned integer types (UInt8, UInt16, UInt32, UInt64).

See Also

bitpack, bitunpack, bswap, flipbits!, htol, hton, isbits, ltoh, ntoh, rol, rol!, ror, ror!, signbit,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: