git: 0839258c5690 - main - ipfw: Use roundup_pow_of_two

From: Doug Moore <dougm_at_FreeBSD.org>
Date: Mon, 24 Jun 2024 07:27:59 UTC
The branch main has been updated by dougm:

URL: https://cgit.FreeBSD.org/src/commit/?id=0839258c5690cd7cd0dcd10a089fc20ce73225c1

commit 0839258c5690cd7cd0dcd10a089fc20ce73225c1
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2024-06-24 07:24:24 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2024-06-24 07:24:24 +0000

    ipfw: Use roundup_pow_of_two
    
    Use roundup_pow_of_two in place of a local function that does the same thing.
    
    Reviewed by:    alc, markj
    Differential Revision:  https://reviews.freebsd.org/D45536
---
 sys/netpfil/ipfw/ip_fw_table.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/sys/netpfil/ipfw/ip_fw_table.c b/sys/netpfil/ipfw/ip_fw_table.c
index 5cf948ce39a2..92bb7a63fd5a 100644
--- a/sys/netpfil/ipfw/ip_fw_table.c
+++ b/sys/netpfil/ipfw/ip_fw_table.c
@@ -1512,13 +1512,6 @@ destroy_table(struct ip_fw_chain *ch, struct tid_info *ti)
 	return (0);
 }
 
-static uint32_t
-roundup2p(uint32_t v)
-{
-
-	return (1 << fls(v - 1));
-}
-
 /*
  * Grow tables index.
  *
@@ -1540,7 +1533,7 @@ ipfw_resize_tables(struct ip_fw_chain *ch, unsigned int ntables)
 	if (ntables > IPFW_TABLES_MAX)
 		ntables = IPFW_TABLES_MAX;
 	/* Alight to nearest power of 2 */
-	ntables = (unsigned int)roundup2p(ntables); 
+	ntables = roundup_pow_of_two(ntables); 
 
 	/* Allocate new pointers */
 	tablestate = malloc(ntables * sizeof(struct table_info),