1 #ifndef SBCL_INCLUDED_CPPUTIL_H
2 #define SBCL_INCLUDED_CPPUTIL_H
6 #define ALIGN_UP(value,granularity) (((value)+(granularity-1))&(~(granularity-1)))
7 #define ALIGN_DOWN(value,granularity) (((value))&(~(granularity-1)))
8 #define IS_ALIGNED(value,granularity) (0==(((value))&(granularity-1)))
10 #define PTR_ALIGN_UP(pointer,granularity) \
11 (typeof(pointer))ALIGN_UP((uintptr_t)pointer,granularity)
13 #define PTR_ALIGN_DOWN(pointer,granularity) \
14 (typeof(pointer))ALIGN_DOWN((uintptr_t)pointer,granularity)
16 #define PTR_IS_ALIGNED(pointer,granularity) \
17 IS_ALIGNED((uintptr_t)pointer,granularity)
19 #endif /* SBCL_INCLUDED_CPPUTIL_H */