-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterp.h
32 lines (26 loc) · 850 Bytes
/
interp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* _GNU_SOURCE doesn't bring in C99 long long constants,
but we do get the GNU constants */
#ifndef LLONG_MAX
#define LLONG_MAX LONG_LONG_MAX
#endif
#ifndef LLONG_MIN
#define LLONG_MIN LONG_LONG_MIN
#endif
#ifdef HAVE_ENDIAN_H
#include <endian.h>
#elif HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#if BYTE_ORDER == BIG_ENDIAN
#define FLOAT_CONST(val) (uintptr_t)val << (sizeof(uintptr_t) * 8 - 32)
#else
#define FLOAT_CONST(val) val
#endif
#define FLOAT_1_BITS FLOAT_CONST(0x3f800000)
#define FLOAT_2_BITS FLOAT_CONST(0x40000000)
#define READ_U1_OP(p) ((p)[1])
#define READ_U2_OP(p) (((p)[1]<<8)|(p)[2])
#define READ_U4_OP(p) (((p)[1]<<24)|((p)[2]<<16)|((p)[3]<<8)|(p)[4])
#define READ_S1_OP(p) (signed char)READ_U1_OP(p)
#define READ_S2_OP(p) (signed short)READ_U2_OP(p)
#define READ_S4_OP(p) (signed int)READ_U4_OP(p)