1
/* FakeNES - A free, portable, Open Source NES emulator.
3
common.h: Global common definitions.
5
Copyright (c) 2001-2006, FakeNES Team.
6
This is free software. See 'LICENSE' for details.
7
You must read and accept the license prior to use. */
9
#ifndef COMMON_H_INCLUDED
10
#define COMMON_H_INCLUDED
23
#define TRUE_OR_FALSE(x) ((x) ? TRUE : FALSE)
28
#define ROUND(x) ((x) + 0.5)
31
#define M_PI 3.14159265358979323846
34
/* <+KittyCat> $ grep EPSILON include/3dobject.h
35
<+KittyCat> #define EPSILON (1.0f/1024.0f)
37
#define EPSILON (1.0 / 1024.0)
40
/* Cleaner lowercase versions for use in 'pure' C++ code. */
44
#define min(x,y) MIN((x),(y))
45
#define max(x,y) MAX((x),(y))
47
#define true_or_false(x) ((x) ? true : false)
52
#define linear INLINE // for functions that are called only once
54
#define epsilon EPSILON
55
#endif /* __cplusplus */
57
/* Macro to compare 2 REALs. */
58
#define COMPARE_TWO_REALS(a, b) \
59
TRUE_OR_FALSE(((a) >= ((b) - EPSILON)) && ((a) <= ((b) + EPSILON)))
61
/* TODO: Remove all references to NIL and correct compiler warnings. */
64
static INLINE int fix (int value, int base, int limit)
74
static INLINE REAL fixf (REAL value, REAL base, REAL limit)
84
#define MAX3(a, b, c) (MAX((a), MAX((b), (c))))
88
#endif /* __cplusplus */
89
#endif /* !COMMON_H_INCLUDED */