Livt packages
Livt.Net
Version 1.4.1
Ethernet, IPv4, TCP, UDP, ARP, TFTP, and Telnet networking components for Livt hardware.
Published files (163)
src/packet/NetworkOrder.lvt
namespace Livt.Net
/**
* Pure network-byte-order conversions. No storage, borrowing or scheduled calls.
*/
class NetworkOrder
{
/**
* Interprets one octet as an unsigned integer in 0..255.
*/
public static inline fn ByteValue[](value: byte) int
{
return (value as uint) as int
}
/**
* Decodes a big-endian word in 0..65535 without sign extension.
*/
public static inline fn Word[](high: byte, low: byte) int
{
return (((high as uint) << 8) | (low as uint)) as int
}
/**
* Returns the high octet of a word. Requires value in 0..65535.
*/
public static inline fn HighByte[](value: int) byte
{
return ((value as uint) >> 8) as byte
}
/**
* Returns the low octet of a word. Requires value in 0..65535.
*/
public static inline fn LowByte[](value: int) byte
{
return ((value as uint) & (0xFF as uint)) as byte
}
}