The endian specific read/write functions read and write data of the specified endianness, dynamically translating to the host machine endianness.
e.g.: If you want to read a 16 bit value on big-endian machine from an opened file containing little endian values, you would use:
value = MGUI_ReadLE16(rp);
Example:
int fd, len_header; ... if (read (fd, &len_header, sizeof (int)) == -1) goto error; #if MGUI_BYTEORDER == MGUI_BIG_ENDIAN /* If the native system is big endian, calling ArchSwap32 to * swap the bytes. */ len_header = ArchSwap32 (len_header); #endif ...
#define ArchSwapBE16 | ( | X | ) | ArchSwap16(X) |
Swaps a 16-bit big endian integer to the native endianness.
Definition at line 435 of file endianrw.h.
#define ArchSwapBE32 | ( | X | ) | ArchSwap32(X) |
Swaps a 32-bit big endian integer to the native endianness.
Definition at line 437 of file endianrw.h.
#define ArchSwapBE64 | ( | X | ) | ArchSwap64(X) |
Swaps a 64-bit big endian integer to the native endianness.
Definition at line 439 of file endianrw.h.
#define ArchSwapLE16 | ( | X | ) | (X) |
Swaps a 16-bit little endian integer to the native endianness.
Definition at line 429 of file endianrw.h.
#define ArchSwapLE32 | ( | X | ) | (X) |
Swaps a 32-bit little endian integer to the native endianness.
Definition at line 431 of file endianrw.h.
#define ArchSwapLE64 | ( | X | ) | (X) |
Swaps a 64-bit little endian integer to the native endianness.
Definition at line 433 of file endianrw.h.
Reads a 16-bit big endian integer from a MG_RWops object.
This function reads a 16-bit big endian integer from the data source pointed to by src, and return it in native format.
src | The pointer to the MG_RWops object. |
Reads a 32-bit big endian integer from a MG_RWops object.
This function reads a 32-bit big endian integer from the data source pointed to by src, and return it in native format.
src | The pointer to the MG_RWops object. |
Reads a 64-bit big endian integer from a MG_RWops object.
This function reads a 64-bit big endian integer from the data source pointed to by src, and return it in native format.
src | The pointer to the MG_RWops object. |
Reads a 16-bit little endian integer from a MG_RWops object.
This function reads a 16-bit little endian integer from the data source pointed to by src, and return it in native format.
src | The pointer to the MG_RWops object. |
Uint16 MGUI_ReadLE16FP | ( | FILE * | src | ) |
Reads a 16-bit little endian integer from a stdio FILE object.
This function reads a 16-bit little endian integer from the stdio FILE object pointed to by src, and return it in native format.
src | The pointer to the stdio FILE object. |
Reads a 32-bit little endian integer from a MG_RWops object.
This function reads a 32-bit little endian integer from the data source pointed to by src, and return it in native format.
src | The pointer to the MG_RWops object. |
Uint32 MGUI_ReadLE32FP | ( | FILE * | src | ) |
Reads a 32-bit little endian integer from a stdio FILE object.
This function reads a 32-bit little endian integer from the stdio FILE object pointed to by src, and return it in native format.
src | The pointer to the stdio FILE object. |
Reads a 64-bit little endian integer from a MG_RWops object.
This function reads a 64-bit little endian integer from the data source pointed to by src, and return it in native format.
src | The pointer to the MG_RWops object. |
Writes an 16-bit integer of native format to a MG_RWops object in big endianness.
This function writes a 16-bit integer of native format to the data source pointed to by src in big endiannes.
src | The pointer to the MG_RWops object. | |
value | The 16-bit integer in native endianness. |
Writes an 32-bit integer of native format to a MG_RWops object in big endianness.
This function writes a 32-bit integer of native format to the data source pointed to by src in big endiannes.
src | The pointer to the MG_RWops object. | |
value | The 32-bit integer in native endianness. |
Writes an 64-bit integer of native format to a MG_RWops object in big endianness.
This function writes a 64-bit integer of native format to the data source pointed to by src in big endiannes.
src | The pointer to the MG_RWops object. | |
value | The 64-bit integer in native endianness. |
Writes an 16-bit integer of native format to a MG_RWops object in littlen endianness.
This function writes a 16-bit integer of native format to the data source pointed to by src in littlen endiannes.
src | The pointer to the MG_RWops object. | |
value | The 16-bit integer in native endianness. |
int MGUI_WriteLE16FP | ( | FILE * | dst, | |
Uint16 | value | |||
) |
Writes an 16-bit integer of native format to a stdio FILE object in littlen endianness.
This function writes a 16-bit integer of native format to the stdio FILE object pointed to by src in littlen endiannes.
dst | The pointer to the MG_RWops object. | |
value | The 16-bit integer in native endianness. |
Writes an 32-bit integer of native format to a MG_RWops object in littlen endianness.
This function writes a 32-bit integer of native format to the data source pointed to by src in littlen endiannes.
src | The pointer to the MG_RWops object. | |
value | The 32-bit integer in native endianness. |
int MGUI_WriteLE32FP | ( | FILE * | dst, | |
Uint32 | value | |||
) |
Writes an 32-bit integer of native format to a stdio FILE object in littlen endianness.
This function writes a 32-bit integer of native format to the stdio FILE object pointed to by src in littlen endiannes.
dst | The pointer to the MG_RWops object. | |
value | The 32-bit integer in native endianness. |
Writes an 64-bit integer of native format to a MG_RWops object in littlen endianness.
This function writes a 64-bit integer of native format to the data source pointed to by src in littlen endiannes.
src | The pointer to the MG_RWops object. | |
value | The 64-bit integer in native endianness. |