Definition in file ind_types.c.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include "ind_types.h"
Include dependency graph for ind_types.c:
Go to the source code of this file.
Defines | |
#define | CHECK_TYPE(typename, expectedsize) |
Verify that the platform-independent types have appropriate values for this architecture. | |
#define | WARN_MISSING(typename) if (warn_if_missing) printf("Note: no %s type defined.\n",#typename) |
#define | swap_endian_proc(type) |
Family of procedures to swap endian-ness for values of different types. | |
Typedefs | |
typedef int | endtype |
Type on which to test endian-ness. | |
Functions | |
int | check_ind_types (int warn_if_missing) |
int | endianness (void) |
Returns 0 for little-endian, 1 for big-endian, and -1 for unknown. |
|
Value: if (sizeof(typename) != expectedsize) { \ printf("Warning -- problem with ind_types: sizeof(%3s)=%d, not %d.\n" \ ,#typename,int(sizeof(typename)),int(expectedsize)); \ errors++; \ }
Definition at line 32 of file ind_types.c. |
|
Value: type type ## _swap_endian(type num) \ { \ unsigned i; \ union { \ type num; \ char c[sizeof(type)]; \ } in,out; \ \ in.num = num; \ for (i=0; i < sizeof(type); i++) \ out.c[i] = in.c[sizeof(type)-1-i]; \ return out.num; \ }
Definition at line 138 of file ind_types.c. |
|
Returns 0 for little-endian, 1 for big-endian, and -1 for unknown. Many compilers (e.g. GCC) define a compile-time constant for endianness, but this routine allows it to be checked, and should work on most ordinary architectures Definition at line 92 of file ind_types.c. References endtype. |