Use the centrally coded ilog2() function.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
#include <core.h>
#include <fs.h>
#include <disk.h>
+#include <ilog2.h>
#define RETRY_COUNT 6
return !(x & (x-1));
}
-static int ilog2(uint32_t num)
-{
- int i = 0;
-
- if (!is_power_of_2(num)) {
- printf("ERROR: the num must be power of 2 when conveting to log2\n");
- return 0;
- }
- while (num >>= 1)
- i++;
- return i;
-}
-
void getoneblk(struct disk *disk, char *buf, block_t block, int block_size)
{
int sec_per_block = block_size / disk->sector_size;