/* ex: set ts=2 et: */ /* Copyright 2008 Ryan Flynn */ /* */ /** * @ref Hacker's Delight * @ref http://graphics.stanford.edu/~seander/bithacks.html */ #ifndef HACKERS_DELIGHT_H #define HACKERS_DELIGHT_H #define DOZ(x,y) #define MIN(x,y) ((y) + (((x) - (y)) & -((x) < (y)))) #define MAX(x,y) ((x) - (((x) - (y)) & -((x) < (y)))) #define CMP(x,y) (((x)>(y)) - ((x)<(y))) #define ISPOW2(n) ((n) && !((n) & ((n) - 1))) #endif