Last active
October 2, 2015 05:37
-
-
Save binshengliu/2181472 to your computer and use it in GitHub Desktop.
align x to 16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* from genromfs.c */ | |
#define ALIGNUP16(x) (((x)+15)&~15) | |
/* from zfs */ | |
#define P2ALIGN(x, align) ((x) & -(align)) | |
#define P2CROSS(x, y, align) (((x) ^ (y)) > (align) - 1) | |
#define P2ROUNDUP(x, align) (-(-(x) & -(align))) | |
#define P2PHASE(x, align) ((x) & ((align) - 1)) | |
#define P2NPHASE(x, align) (-(x) & ((align) - 1)) | |
#define ISP2(x) (((x) & ((x) - 1)) == 0) | |
#define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1))==0) | |
#define P2BOUNDARY(off, len, align) \ | |
(((off) ^ ((off) + (len) - 1)) > (align) - 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment