altos/scheme: Replace memory pool macros with inlines
[fw/altos] / src / scheme / ao_scheme.h
index b8e683fb0c83acd5a8e0744f3f2dc50b1ca48f8f..5cae0bda0558dc17f630be0e8dda60c9d58480ee 100644 (file)
@@ -155,8 +155,17 @@ ao_scheme_is_const(ao_poly poly) {
        return poly & AO_SCHEME_CONST;
 }
 
-#define AO_SCHEME_IS_CONST(a)  (ao_scheme_const <= ((uint8_t *) (a)) && ((uint8_t *) (a)) < ao_scheme_const + AO_SCHEME_POOL_CONST)
-#define AO_SCHEME_IS_POOL(a)   (ao_scheme_pool <= ((uint8_t *) (a)) && ((uint8_t *) (a)) < ao_scheme_pool + AO_SCHEME_POOL)
+static inline int
+ao_scheme_is_const_addr(const void *addr) {
+       const uint8_t *a = addr;
+       return (ao_scheme_const <= a) && (a < ao_scheme_const + AO_SCHEME_POOL_CONST);
+}
+
+static inline int
+ao_scheme_is_pool_addr(const void *addr) {
+       const uint8_t *a = addr;
+       return (ao_scheme_pool <= a) && (a < ao_scheme_pool + AO_SCHEME_POOL);
+}
 
 void *
 ao_scheme_ref(ao_poly poly);