1995-08-09 08:06:35 -07:00
|
|
|
/***********************************************************************/
|
|
|
|
/* */
|
1996-04-30 07:53:58 -07:00
|
|
|
/* Objective Caml */
|
1995-08-09 08:06:35 -07:00
|
|
|
/* */
|
|
|
|
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
|
|
|
|
/* */
|
1996-04-30 07:53:58 -07:00
|
|
|
/* Copyright 1996 Institut National de Recherche en Informatique et */
|
1995-08-09 08:06:35 -07:00
|
|
|
/* Automatique. Distributed only by permission. */
|
|
|
|
/* */
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
1998-04-06 02:15:55 -07:00
|
|
|
/* Swap byte-order in 32-bit integers and in 64-bit floats */
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
#ifndef _reverse_
|
|
|
|
#define _reverse_
|
|
|
|
|
|
|
|
#define Reverse_int32(w) { \
|
|
|
|
char * _p; \
|
|
|
|
int _a; \
|
|
|
|
_p = (char *) (w); \
|
|
|
|
_a = _p[0]; \
|
|
|
|
_p[0] = _p[3]; \
|
|
|
|
_p[3] = _a; \
|
|
|
|
_a = _p[1]; \
|
|
|
|
_p[1] = _p[2]; \
|
|
|
|
_p[2] = _a; \
|
|
|
|
}
|
|
|
|
|
1998-04-06 02:15:55 -07:00
|
|
|
#define Reverse_double(d) { \
|
1995-05-04 03:15:53 -07:00
|
|
|
char * _p; \
|
|
|
|
int _a; \
|
|
|
|
_p = (char *) (d); \
|
|
|
|
_a = _p[0]; \
|
|
|
|
_p[0] = _p[7]; \
|
|
|
|
_p[7] = _a; \
|
|
|
|
_a = _p[1]; \
|
|
|
|
_p[1] = _p[6]; \
|
|
|
|
_p[6] = _a; \
|
|
|
|
_a = _p[2]; \
|
|
|
|
_p[2] = _p[5]; \
|
|
|
|
_p[5] = _a; \
|
|
|
|
_a = _p[3]; \
|
|
|
|
_p[3] = _p[4]; \
|
|
|
|
_p[4] = _a; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _reverse_ */
|