#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. More... | |
| #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. More... | |
Typedefs | |
| typedef int | endtype |
| Type on which to test endian-ness. More... | |
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. More... | |
Definition in file ind_types.c.
|
|
Initializer: \
if (sizeof(typename) != expectedsize) { \
printf("Warning -- problem with ind_types: sizeof(%3s)=%d, not %d.\n" \
,#typename,sizeof(typename),expectedsize); \
errors++; \
}
Definition at line 32 of file ind_types.c. |
|
|
Definition at line 40 of file ind_types.c. |
|
|
Initializer: \
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. |
|
|
Type on which to test endian-ness.
Definition at line 20 of file ind_types.c. |
|
|
Definition at line 43 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. Referenced by binaryWeightsFileRead(), binaryWeightsFileWrite(), and printTokens(). |
1.2.1 written by Dimitri van Heesch,
© 1997-2000