Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Jun 2024 07:28:00 GMT
From:      Doug Moore <dougm@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 5dbf886104b4 - main - x86: use order_base_2
Message-ID:  <202406240728.45O7S0fT044605@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by dougm:

URL: https://cgit.FreeBSD.org/src/commit/?id=5dbf886104b45fea255987ee2ae4828b8d002ffe

commit 5dbf886104b45fea255987ee2ae4828b8d002ffe
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2024-06-24 07:26:23 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2024-06-24 07:26:23 +0000

    x86: use order_base_2
    
    Use order_base_2 in place of expressions involving fls.
    
    Reviewed by:    alc, markj
    Differential Revision:  https://reviews.freebsd.org/D45536
---
 sys/amd64/vmm/x86.c  | 2 +-
 sys/x86/x86/mp_x86.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/amd64/vmm/x86.c b/sys/amd64/vmm/x86.c
index aa8f87c98fe8..1167652d88ea 100644
--- a/sys/amd64/vmm/x86.c
+++ b/sys/amd64/vmm/x86.c
@@ -67,7 +67,7 @@ static __inline int
 log2(u_int x)
 {
 
-	return (x == 0 ? -1 : fls(x - 1));
+	return (x == 0 ? -1 : order_base_2(x));
 }
 
 int
diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c
index 3c08f7fa987d..0a683b3e841a 100644
--- a/sys/x86/x86/mp_x86.c
+++ b/sys/x86/x86/mp_x86.c
@@ -189,7 +189,7 @@ static __inline int
 mask_width(u_int x)
 {
 
-	return (x == 0 ? -1 : fls(x - 1));
+	return (x == 0 ? -1 : order_base_2(x));
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202406240728.45O7S0fT044605>