#include "libnjb.h"#include "byteorder.h"Functions | |
| u_int64_t | njb1_bytes_to_64bit (unsigned char *dp) |
| void | from_64bit_to_njb1_bytes (u_int64_t val, unsigned char *dp) |
| u_int32_t | njb1_bytes_to_32bit (unsigned char *dp) |
| u_int32_t | njb3_bytes_to_32bit (unsigned char *dp) |
| void | from_32bit_to_njb1_bytes (u_int32_t val, unsigned char *dp) |
| void | from_32bit_to_njb3_bytes (u_int32_t val, unsigned char *dp) |
| u_int16_t | njb1_bytes_to_16bit (unsigned char *dp) |
| u_int16_t | njb3_bytes_to_16bit (unsigned char *dp) |
| void | from_16bit_to_njb1_bytes (u_int16_t val, unsigned char *dp) |
| void | from_16bit_to_njb3_bytes (u_int16_t val, unsigned char *dp) |
| u_int16_t | get_msw (u_int32_t word) |
| u_int16_t | get_lsw (u_int32_t word) |
| u_int64_t | make64 (u_int32_t msdw, u_int32_t lsdw) |
| void | split64 (u_int64_t num, u_int32_t *msdw, u_int32_t *lsdw) |
NJB1 and the "series 3 family" (NJB2, NJB3, NJB Zen, NJB Zen 2.0) have different byte ordering. NJB1 is essentially big-endian, and the series 3 family little-endian. The terminology could be confusing, so we refer to the different endiannesses as "njb1-endian" and "njb3-endian".
| void from_16bit_to_njb1_bytes | ( | u_int16_t | val, | |
| unsigned char * | dp | |||
| ) |
This function will write the u_int16_t of the host platform, val as 2 NJB1-endian bytes beginning at the first byte in the byte array pointed to by *dp.
| val | the unsigned 16 bit integer to convert to bytes | |
| dp | a pointer to the byte array (of atleast 2 bytes) that shall hold the resulting bytes |
| void from_16bit_to_njb3_bytes | ( | u_int16_t | val, | |
| unsigned char * | dp | |||
| ) |
This function will write the u_int16_t of the host platform, val as 2 series 3-endian bytes beginning at the first byte in the byte array pointed to by *dp.
| val | the unsigned 16 bit integer to convert to bytes | |
| dp | a pointer to the byte array (of atleast 2 bytes) that shall hold the resulting bytes |
| void from_32bit_to_njb1_bytes | ( | u_int32_t | val, | |
| unsigned char * | dp | |||
| ) |
This function will write the u_int32_t of the host platform, val as 4 NJB1-endian bytes beginning at the first byte in the byte array pointed to by *dp.
| val | the unsigned 32 bit integer to convert to bytes | |
| dp | a pointer to the byte array (of atleast 4 bytes) that shall hold the resulting bytes |
| void from_32bit_to_njb3_bytes | ( | u_int32_t | val, | |
| unsigned char * | dp | |||
| ) |
This function will write the u_int32_t of the host platform, val as 4 series 3-endian bytes beginning at the first byte in the byte array pointed to by *dp.
| val | the unsigned 32 bit integer to convert to bytes | |
| dp | a pointer to the byte array (of atleast 4 bytes) that shall hold the resulting bytes |
| void from_64bit_to_njb1_bytes | ( | u_int64_t | val, | |
| unsigned char * | dp | |||
| ) |
This function will write the u_int64_t of the host platform, val as NJB1-endian bytes beginning at the first byte in the byte array pointed to by *dp.
| val | the unsigned 64 bit integer to convert to bytes | |
| dp | a pointer to the byte array (of atleast 8 bytes) that shall hold the resulting bytes |
| u_int16_t get_lsw | ( | u_int32_t | word | ) |
This simply extract the least significant 16 bit parts of a 32 bit word.
| word | the 32 bit word to get the least significant 16 bits for |
| u_int16_t get_msw | ( | u_int32_t | word | ) |
This simply extract the most significant 16 bit parts of a 32 bit word.
| word | the 32 bit word to get the most significant 16 bits for |
| u_int64_t make64 | ( | u_int32_t | msdw, | |
| u_int32_t | lsdw | |||
| ) |
Create a 64 bit unsigned integer from two 32 bit integers representing the most/least significant part of it.
| msdw | the most significant 32 bits | |
| lsdw | the least significant 32 bits |
| u_int16_t njb1_bytes_to_16bit | ( | unsigned char * | dp | ) |
This function will take 2 bytes from the NJB1-endian byte array pointed to by *dp and transform it to a u_int16_t unsigned 16 bit integer on the host platform.
| dp | a pointer to the 2 raw bytes in NJB1 endianness to convert |
| u_int32_t njb1_bytes_to_32bit | ( | unsigned char * | dp | ) |
This function will take 4 bytes from the NJB1-endian byte array pointed to by *dp and transform it to a u_int32_t on the host platform.
| dp | a pointer to the 4 raw bytes in NJB1 endianness to convert |
| u_int64_t njb1_bytes_to_64bit | ( | unsigned char * | dp | ) |
This function will take 8 bytes from the njb1-endian byte array pointed to by *dp and transform it to a u_int64_t on the host platform.
| dp | a pointer to the 8 raw bytes in NJB1 endianness to convert |
| u_int16_t njb3_bytes_to_16bit | ( | unsigned char * | dp | ) |
This function will take 2 bytes from the series 3-endian byte array pointed to by *dp and transform it to a u_int16_t unsigned 16 bit integer on the host platform.
| dp | a pointer to the 2 raw bytes in series 3 endianness to convert |
| u_int32_t njb3_bytes_to_32bit | ( | unsigned char * | dp | ) |
This function will take 4 bytes from the series 3-endian byte array pointed to by *dp and transform it to a u_int32_t on the host platform.
| dp | a pointer to the 4 raw bytes in series 3 endianness to convert |
| void split64 | ( | u_int64_t | num, | |
| u_int32_t * | msdw, | |||
| u_int32_t * | lsdw | |||
| ) |
Split a 64 bit unsigned integer into two unsigned 32 bit integer representing the most/least significant 32 bits of the incoming 64 bit integer.
| num | the 64 bit integer to split | |
| msdw | a pointer to the 32 bit integer that shall hold the most significant 32 bits of the 64 bit integer | |
| lsdw | a pointer to the 32 bit integer that shall hold the least significant 32 bits of the 64 bit integer |
1.5.2