macros: add align_up()

tags/0.1.0
S.J.R. van Schaik 7 years ago
parent a7d71e84cf
commit bf677b7655
  1. 1
      include/macros.h

@ -22,6 +22,7 @@
#define ROUND_UP(x, k) (((x) + (k) - 1) & ~((k) - 1))
#define align(x, k) ((x) & ~((1 << (k)) - 1))
#define align_up(x, k) align(x + ((1 << (k)) - 1), k)
#define is_aligned(x, k) (!((x) & ((1 << (k)) - 1)))
#define align_eq(x, y, k) (!(((x) ^ (y)) >> k))

Loading…
Cancel
Save