4 #include <console/console.h>
7 /* Assume 8 bits per byte */
10 unsigned long log2(unsigned long x);
12 unsigned long log2(unsigned long x)
14 // assume 8 bits per byte.
15 unsigned long i = 1ULL << (sizeof(x)* CHAR_BIT - 1ULL);
16 unsigned long pow = sizeof(x) * CHAR_BIT - 1ULL;
20 printk_warning("%s called with invalid parameter of 0\n",
25 for(; i > x; i >>= 1, pow--)