diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h index 4dc7cd8585..4a96e075ff 100644 --- a/include/sys/sysmacros.h +++ b/include/sys/sysmacros.h @@ -186,7 +186,7 @@ extern void spl_cleanup(void); */ #define P2ALIGN(x, align) ((x) & -(align)) #define P2CROSS(x, y, align) (((x) ^ (y)) > (align) - 1) -#define P2ROUNDUP(x, align) (-(-(x) & -(align))) +#define P2ROUNDUP(x, align) ((((x) - 1) | ((align) - 1)) + 1) #define P2PHASE(x, align) ((x) & ((align) - 1)) #define P2NPHASE(x, align) (-(x) & ((align) - 1)) #define ISP2(x) (((x) & ((x) - 1)) == 0) @@ -213,7 +213,7 @@ extern void spl_cleanup(void); #define P2NPHASE_TYPED(x, align, type) \ (-(type)(x) & ((type)(align) - 1)) #define P2ROUNDUP_TYPED(x, align, type) \ - (-(-(type)(x) & -(type)(align))) + ((((type)(x) - 1) | ((type)(align) - 1)) + 1) #define P2END_TYPED(x, align, type) \ (-(~(type)(x) & -(type)(align))) #define P2PHASEUP_TYPED(x, align, phase, type) \