/*! \file util.c \brief Various utility routines \date Started 4/12/2007 \author George \version\verbatim $Id: util.c 10711 2011-08-31 22:23:04Z karypis $ \endverbatim */ #include "GKlib.h" /************************************************************************* * This file randomly permutes the contents of an array. * flag == 0, don't initialize perm * flag == 1, set p[i] = i **************************************************************************/ void gk_RandomPermute(size_t n, int *p, int flag) { gk_idx_t i, u, v; int tmp; if (flag == 1) { for (i=0; i 1; i++, a = a>>1); return i-1; } /************************************************************************* * This function checks if the argument is a power of 2 **************************************************************************/ int gk_ispow2(int a) { return (a == (1<