Word16 package:bytesmith
Parse a LEB-128-encoded number. If the number is larger than
0xFFFF, fails with the provided error.
Parse an array of big-endian unsigned 16-bit words. If the host is
big-endian, the implementation is optimized to simply memcpy
bytes into the result array. The result array always has elements in
native-endian byte order.
Array of little-endian unsigned 16-bit words. If the host is
little-endian, the implementation is optimized to simply
memcpy bytes into the result array. The result array always
has elements in native-endian byte order.
Parse a decimal-encoded 16-bit word. If the number is larger than
65535, this parser fails.
Parse exactly four ASCII-encoded characters, interpreting them as the
hexadecimal encoding of a 16-bit number. Note that this rejects a
sequence such as 5A9, requiring 05A9 instead. This
is insensitive to case. This is particularly useful when parsing
escape sequences in C or JSON, which allow encoding characters in the
Basic Multilingual Plane as \uhhhh.
Parse a hexadecimal-encoded 16-bit word. If the number is larger than
65535, this parser fails. This allows leading zeroes and is
insensitive to case. For example, 0100a and 100A
would both be accepted as the same number.