X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;ds=sidebyside;f=daemon%2Fguestfsd.c;h=49aca08d2bd08856d329d97db989610f48666743;hb=0da3d72174642da66a3370c8f661aa7e47925bf0;hp=f9e5a682b2066401ec6167605c159b9df7d2ff2a;hpb=aee7d55fcf754d97d945c318ec06d6387ade067b;p=libguestfs.git diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index f9e5a68..49aca08 100644 --- a/daemon/guestfsd.c +++ b/daemon/guestfsd.c @@ -554,6 +554,13 @@ count_strings (char *const *argv) return argc; } +/* http://graphics.stanford.edu/~seander/bithacks.html#DetermineIfPowerOf2 */ +int +is_power_of_2 (unsigned long v) +{ + return v && ((v & (v - 1)) == 0); +} + static int compare (const void *vp1, const void *vp2) {