git: 88122c8eb70d - stable/15 - LinuxKPI: maths64: implement roundup_u64()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 15 Sep 2025 19:11:20 UTC
The branch stable/15 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=88122c8eb70d81decb7c6dd16e551c3df6ad3818 commit 88122c8eb70d81decb7c6dd16e551c3df6ad3818 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-15 14:52:54 +0000 LinuxKPI: maths64: implement roundup_u64() Needed by a wifi driver update. Sponsored by: The FreeBSD Foundation (initially) Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52080 (cherry picked from commit 2a44e10edb13e6b2be7fa2814b418a6959cb1171) --- 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__)