summaryrefslogtreecommitdiff
path: root/src/lisp/ao_lisp_poly.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2016-11-16 14:12:59 -0800
committerKeith Packard <keithp@keithp.com>2016-11-17 22:18:39 -0800
commit2b44fb5002c3e498ba66b60d763c2ac3fef3283e (patch)
tree650e22b3d9ed77549de88a3859f85b21a3075fa0 /src/lisp/ao_lisp_poly.c
parentd68d89a2b8d2c1ebde355171f99e5205dbd0ea43 (diff)
altos/lisp: Eliminate compiler warning about array bounds at -O3
Using ao_lisp_pool - 4 caused the compiler to whinge about computing an address outside the bounds of the array. Sigh. Restructure the code to do the adjustment-by-4 in the integer computations instead of the pointer ones. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/lisp/ao_lisp_poly.c')
-rw-r--r--src/lisp/ao_lisp_poly.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lisp/ao_lisp_poly.c b/src/lisp/ao_lisp_poly.c
index 9717fd73..236176e7 100644
--- a/src/lisp/ao_lisp_poly.c
+++ b/src/lisp/ao_lisp_poly.c
@@ -89,8 +89,8 @@ ao_lisp_ref(ao_poly poly) {
if (poly == AO_LISP_NIL)
return NULL;
if (poly & AO_LISP_CONST)
- return (void *) (AO_LISP_CONST_BASE + (poly & AO_LISP_REF_MASK));
- return (void *) (AO_LISP_POOL_BASE + (poly & AO_LISP_REF_MASK));
+ return (void *) (ao_lisp_const + (poly & AO_LISP_REF_MASK) - 4);
+ return (void *) (ao_lisp_pool + (poly & AO_LISP_REF_MASK) - 4);
}
ao_poly
@@ -99,6 +99,6 @@ ao_lisp_poly(const void *addr, ao_poly type) {
if (a == NULL)
return AO_LISP_NIL;
if (AO_LISP_IS_CONST(a))
- return AO_LISP_CONST | (a - AO_LISP_CONST_BASE) | type;
- return (a - AO_LISP_POOL_BASE) | type;
+ return AO_LISP_CONST | (a - ao_lisp_const + 4) | type;
+ return (a - ao_lisp_pool + 4) | type;
}