Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jul 2024 16:52:29 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: 1d897d19f31d - main - netisr: avoid ffs(0)
Message-ID:  <202407261652.46QGqTFI010127@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=1d897d19f31dd6d0411eb01ac4695e1c6aa8836a

commit 1d897d19f31dd6d0411eb01ac4695e1c6aa8836a
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2024-07-26 16:51:17 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2024-07-26 16:51:17 +0000

    netisr: avoid ffs(0)
    
    A rearrangement to avoid computing ffs(0) saves 128 bytes in resulting
    amd64 object code.
    
    Reviewed by:    brooks
    Differential Revision:  https://reviews.freebsd.org/D41254
---
 sys/net/netisr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/net/netisr.c b/sys/net/netisr.c
index 8c44d112a4e3..4ae1aa9ab89d 100644
--- a/sys/net/netisr.c
+++ b/sys/net/netisr.c
@@ -968,8 +968,8 @@ swi_net(void *arg)
 	nwsp->nws_flags |= NWS_RUNNING;
 	nwsp->nws_flags &= ~NWS_SCHEDULED;
 	while ((bits = nwsp->nws_pendingbits) != 0) {
-		while ((prot = ffs(bits)) != 0) {
-			prot--;
+		while (bits != 0) {
+			prot = ffs(bits) - 1;
 			bits &= ~(1 << prot);
 			(void)netisr_process_workstream_proto(nwsp, prot);
 		}



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