git: 2a44e10edb13 - main - LinuxKPI: maths64: implement roundup_u64()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 05 Sep 2025 23:29:10 UTC
The branch main has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=2a44e10edb13e6b2be7fa2814b418a6959cb1171
commit 2a44e10edb13e6b2be7fa2814b418a6959cb1171
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-09-04 20:27:48 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-09-05 23:24:16 +0000
LinuxKPI: maths64: implement roundup_u64()
Needed by a wifi driver update.
Sponsored by: The FreeBSD Foundation (initially)
MFC after: 3 days
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D52080
---
sys/compat/linuxkpi/common/include/linux/math64.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sys/compat/linuxkpi/common/include/linux/math64.h b/sys/compat/linuxkpi/common/include/linux/math64.h
index a216d350570f..25ca9da1b622 100644
--- a/sys/compat/linuxkpi/common/include/linux/math64.h
+++ b/sys/compat/linuxkpi/common/include/linux/math64.h
@@ -98,6 +98,12 @@ div64_u64_round_up(uint64_t dividend, uint64_t divisor)
return ((dividend + divisor - 1) / divisor);
}
+static inline uint64_t
+roundup_u64(uint64_t x1, uint32_t x2)
+{
+ return (div_u64(x1 + x2 - 1, x2) * x2);
+}
+
#define DIV64_U64_ROUND_UP(...) \
div64_u64_round_up(__VA_ARGS__)