summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@gnugeneration.com>2016-12-30 20:39:11 -0800
committerVito Caputo <vcaputo@gnugeneration.com>2016-12-30 20:39:11 -0800
commit2273d9a80f4a087219d3d5fbdfa60037aabfecbf (patch)
treea8e6668f3293d85ad8094298ad2f3aa9186e14bd
parent7ac8684cd7928fcc497ddcfce06cf3b04d2ed7e5 (diff)
roto: some fixed point macro cleanups
-rw-r--r--modules/roto/roto.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/modules/roto/roto.c b/modules/roto/roto.c
index 21e68b7..bbf8bdb 100644
--- a/modules/roto/roto.c
+++ b/modules/roto/roto.c
@@ -8,13 +8,14 @@
/* Copyright (C) 2016 Vito Caputo <vcaputo@pengaru.com> */
/* Some defines for the fixed-point stuff in render(). */
-#define FIXED_TRIG_LUT_SIZE 4096 /* size of the cos/sin look-up tables */
-#define FIXED_BITS 12 /* fractional bits */
-#define FIXED_EXP 4096 /* 2^FIXED_BITS */
-#define FIXED_COS(_rad) costab[_rad % FIXED_TRIG_LUT_SIZE]
-#define FIXED_SIN(_rad) sintab[_rad % FIXED_TRIG_LUT_SIZE]
-#define FIXED_MULT(_a, _b) ((_a * _b) >> FIXED_BITS)
-#define FIXED_NEW(_i) (_i << FIXED_BITS)
+#define FIXED_TRIG_LUT_SIZE 4096 /* size of the cos/sin look-up tables */
+#define FIXED_BITS 11 /* fractional bits */
+#define FIXED_EXP (1 << FIXED_BITS) /* 2^FIXED_BITS */
+#define FIXED_MASK (FIXED_EXP - 1) /* fractional part mask */
+#define FIXED_COS(_rad) costab[(_rad) % FIXED_TRIG_LUT_SIZE]
+#define FIXED_SIN(_rad) sintab[(_rad) % FIXED_TRIG_LUT_SIZE]
+#define FIXED_MULT(_a, _b) (((_a) * (_b)) >> FIXED_BITS)
+#define FIXED_NEW(_i) ((_i) << FIXED_BITS)
#define FIXED_TO_INT(_f) ((_f) >> FIXED_BITS)
© All Rights Reserved