aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib/sys/vesa
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2010-06-09 11:21:52 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2010-06-09 11:26:22 -0700
commit8ae3122d64ef1434b2b11b25cacd77d65663b3fa (patch)
treef81648afbee88ed39e19b65de96f164de544313d /com32/lib/sys/vesa
parent95c91f42886abdd9af08cbed66b50dd37eb555dc (diff)
downloadsyslinux-8ae3122d64ef1434b2b11b25cacd77d65663b3fa.tar.gz
syslinux-8ae3122d64ef1434b2b11b25cacd77d65663b3fa.tar.xz
syslinux-8ae3122d64ef1434b2b11b25cacd77d65663b3fa.zip
Unify instances of integer log2
Unify multiple open-coded instances of integer binary logarithm. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'com32/lib/sys/vesa')
-rw-r--r--com32/lib/sys/vesa/background.c4
-rw-r--r--com32/lib/sys/vesa/screencpy.c7
2 files changed, 3 insertions, 8 deletions
diff --git a/com32/lib/sys/vesa/background.c b/com32/lib/sys/vesa/background.c
index 8d732395..93577461 100644
--- a/com32/lib/sys/vesa/background.c
+++ b/com32/lib/sys/vesa/background.c
@@ -34,6 +34,7 @@
#include <sys/stat.h>
#include <minmax.h>
#include <stdbool.h>
+#include <ilog2.h>
#include <syslinux/loadfile.h>
#include "vesa.h"
#include "video.h"
@@ -255,8 +256,7 @@ int vesacon_default_background(void)
z = max(__vesa_info.mi.v_res, __vesa_info.mi.h_res) >> 1;
z = ((z*z) >> 11) - 1;
- asm("bsrl %1,%0" : "=r" (shft) : "rm" (z));
- shft++;
+ shft = ilog2(z) + 1;
for (y = 0, dy = -(__vesa_info.mi.v_res >> 1);
y < __vesa_info.mi.v_res; y++, dy++) {
diff --git a/com32/lib/sys/vesa/screencpy.c b/com32/lib/sys/vesa/screencpy.c
index 9740ea14..32dce9e6 100644
--- a/com32/lib/sys/vesa/screencpy.c
+++ b/com32/lib/sys/vesa/screencpy.c
@@ -30,6 +30,7 @@
#include <klibc/compiler.h>
#include <string.h>
#include <com32.h>
+#include <ilog2.h>
#include "vesa.h"
#include "video.h"
@@ -41,12 +42,6 @@ static struct win_info {
int win_num;
} wi;
-static inline int __constfunc ilog2(unsigned int x)
-{
- asm("bsrl %1,%0" : "=r"(x) : "rm"(x));
- return x;
-}
-
void __vesacon_init_copy_to_screen(void)
{
struct vesa_mode_info *const mi = &__vesa_info.mi;