TiFFEP Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
#include <tiffep.h> (macros.h) #define LSW (l) #define MSW (l) #define LSB (w) #define MSB (w) #define LSN (b) #define MSN (b) #define BCD (val) #define L_NIBBLE2BYTE (u, l) #define L_NIBBLE2WORD (ll, lu, ul, uu) #define L_BYTE2WORD (l, u) #define L_BYTE2LONGWORD (ll, lu, ul, uu) #define L_WORD2LONGWORD (l, u) #define B_NIBBLE2BYTE (u, l) #define B_NIBBLE2WORD (uu, ul, lu, ll) #define B_BYTE2WORD (u, l) #define B_BYTE2LONGWORD (uu, ul, lu, ll) #define B_WORD2LONGWORD (u, l) |
The byte order is the order in which bytes are stored to create larger data types such as the word and longword values. The host byte order is the byte order used on the current machine.
Some processors store the most significant bytes (i.e. the bytes that hold the largest part of the value) first. These are known as big-endian processors.
Other processors (notably the x86 family) store the most significant byte last. These are known as little-endian processors.
Finally, to complicate matters, some other processors store the bytes
in a rather curious order known as PDP-endian. For a 4-byte word, the 3rd
most significant byte is stored first, then the 4th, then the 1st and finally
the 2nd.
#define LSW(l) |
Extract the least significant word from the longword.
l : | a longword value (32 bits). |
Returns : | the least significant word. |
#define MSW(l) |
Extract the most significant word from the longword.
l : | a longword value (32 bits). |
Returns : | the most significant word. |
#define LSB(w) |
Extract the least significant byte from the word.
l : | a longword value (16 bits). |
Returns : | the least significant byte. |
#define MSW(w) |
Extract the most significant byte from the word.
l : | a longword value (32 bits). |
Returns : | the least significant word. |
#define LSN(b) |
Extract the least significant nibble from the byte.
l : | a longword value (32 bits). |
Returns : | the least significant word. |
#define MSN(b) |
Extract the most significant nibble from the byte.
l : | a longword value (32 bits). |
Returns : | the least significant word. |
#define BCD(l) |
Convert a word into a BCD number. Example: 0x45 -> 45 (0x2D).
l : | a longword value (32 bits). |
Returns : | the least significant word. |
#define LSW(l) |
Extract the least significant word from the longword.
l : | a longword value (32 bits). |
Returns : | the least significant word. |
#define L_NIBBLE2BYTE(l, u) |
Convert 2 nibbles into 1 byte (little-endian).
l : | a longword value (32 bits). |
Returns : | the least significant word. |
#define L_NIBBLE2WORD(ll, lu, ul, uu) |
Convert 4 nibbles into 1 longword (little-endian order).
l : | a longword value (32 bits). |
Returns : | the least significant word. |
#define L_BYTE2WORD(l, u) |
Convert 2 bytes into 1 word (little-endian order).
l : | a longword value (32 bits). |
Returns : | the least significant word. |
#define L_BYTE2LONGWORD(ll, lu, ul, uu) |
Convert 4 bytes into 1 longword (little-endian order).
l : | a longword value (32 bits). |
Returns : | the least significant word. |
#define L_WORD2LONGWORD(l, u) |
Convert 2 word into 1 longword (litte-endian order).
l : | a longword value (32 bits). |
Returns : | the least significant word. |
#define B_NIBBLE2BYTE(u, l) |
Convert 2 nibbles into 1 byte (big-endian order).
l : | a longword value (32 bits). |
Returns : | the least significant word. |
#define B_NIBBLE2WORD(uu, ul, lu, ll) |
Convert 4 nibbles into 1 word (big-endian order).
l : | a longword value (32 bits). |
Returns : | the least significant word. |
#define B_BYTE2WORD(u, l) |
Convert 2 bytes into 1 word (big-endian order).
l : | a longword value (32 bits). |
Returns : | the least significant word. |
#define B_BYTE2LONGWORD(uu, ul, lu, ll) |
Convert 4 bytes into 1 longword (big-endian order).
l : | a longword value (32 bits). |
Returns : | the least significant word. |
#define B_WORD2LONGWORD(u, l) |
Convert 2 words into 1 longword (big-endian order).
l : | a longword value (32 bits). |
Returns : | the least significant word. |
<<< Previous Page | Home | Up | Next Page >>> |
Type Conversion Macros | Miscellaneous Macros |