diff options
author | Keith Packard <keithp@keithp.com> | 2016-11-16 14:12:59 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2017-02-20 11:16:51 -0800 |
commit | bcf5eb5825b1217d74f117b02d09b4ce4b007beb (patch) | |
tree | 0a94b887624b456127aee901d0364905b5bec5e2 /src/lisp/ao_lisp_poly.c | |
parent | a5ef084659205700aab33e81d20fb89833c03249 (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.c | 8 |
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; } |