diff options
| author | Bjoern A. Zeeb <bz@FreeBSD.org> | 2025-09-04 20:27:48 +0000 |
|---|---|---|
| committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2025-09-05 23:24:16 +0000 |
| commit | 2a44e10edb13e6b2be7fa2814b418a6959cb1171 (patch) | |
| tree | ea16c83996eb4ea62c8058deb8a5593c34bde857 | |
| parent | 7c473933624f701263a83da526cac680b1ca69ed (diff) | |
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
| -rw-r--r-- | sys/compat/linuxkpi/common/include/linux/math64.h | 6 |
1 files changed, 6 insertions, 0 deletions
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__) |
