[syslinux:master] diskio: remove locally coded ilog2()

syslinux-bot for H. Peter Anvin hpa at linux.intel.com
Fri Jul 16 16:39:02 PDT 2010


Commit-ID:  626d58ed66e1f555f4cb112349652c8455263ac9
Gitweb:     http://syslinux.zytor.com/commit/626d58ed66e1f555f4cb112349652c8455263ac9
Author:     H. Peter Anvin <hpa at linux.intel.com>
AuthorDate: Fri, 16 Jul 2010 16:35:41 -0700
Committer:  H. Peter Anvin <hpa at linux.intel.com>
CommitDate: Fri, 16 Jul 2010 16:35:41 -0700

diskio: remove locally coded ilog2()

Use the centrally coded ilog2() function.

Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>


---
 core/fs/diskio.c |   14 +-------------
 1 files changed, 1 insertions(+), 13 deletions(-)

diff --git a/core/fs/diskio.c b/core/fs/diskio.c
index 55a9df4..b6722e7 100644
--- a/core/fs/diskio.c
+++ b/core/fs/diskio.c
@@ -6,6 +6,7 @@
 #include <core.h>
 #include <fs.h>
 #include <disk.h>
+#include <ilog2.h>
 
 #define RETRY_COUNT 6
 
@@ -291,19 +292,6 @@ static inline bool is_power_of_2(uint32_t x)
     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;



More information about the Syslinux-commits mailing list