vmem: Fix the gcc build

gcc complains when building libuvmem because the last two operands of ?:
in ORDER2SIZE and SIZE2ORDER have different signs.  Add explicit casts
to address this.

Reported by:	Jenkins
Reviewed by:	alc, kib
MFC after:	1 week
Fixes:		1ecf01065b ("libuvmem: usermode port of vmem(9)")
Differential Revision:	https://reviews.freebsd.org/D54268
This commit is contained in:
Mark Johnston
2025-12-17 20:54:40 +00:00
parent ad7f49f98b
commit 377e6050c1
+6 -4
View File
@@ -285,10 +285,12 @@ static LIST_HEAD(, vmem) vmem_list = LIST_HEAD_INITIALIZER(vmem_list);
#define VMEM_CROSS_P(addr1, addr2, boundary) \
((((addr1) ^ (addr2)) & -(boundary)) != 0)
#define ORDER2SIZE(order) ((order) < VMEM_OPTVALUE ? ((order) + 1) : \
(vmem_size_t)1 << ((order) - (VMEM_OPTVALUE - VMEM_OPTORDER - 1)))
#define SIZE2ORDER(size) ((size) <= VMEM_OPTVALUE ? ((size) - 1) : \
(flsl(size) + (VMEM_OPTVALUE - VMEM_OPTORDER - 2)))
#define ORDER2SIZE(order) ((order) < VMEM_OPTVALUE ? \
(vmem_size_t)((order) + 1) : \
(vmem_size_t)1 << ((order) - (VMEM_OPTVALUE - VMEM_OPTORDER - 1)))
#define SIZE2ORDER(size) ((size) <= VMEM_OPTVALUE ? \
(int)((size) - 1) : \
(flsl(size) + (VMEM_OPTVALUE - VMEM_OPTORDER - 2)))
/*
* Maximum number of boundary tags that may be required to satisfy an