Date: Mon, 18 May 2020 09:24:36 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r361195 - stable/11/sys/compat/linuxkpi/common/include/linux Message-ID: <202005180924.04I9Oas3064738@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Mon May 18 09:24:36 2020 New Revision: 361195 URL: https://svnweb.freebsd.org/changeset/base/361195 Log: MFC r360530: Implement DIV64_U64_ROUND_UP() in the LinuxKPI. Submitted by: ashafer_badland.io (Austin Shafer) Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/math64.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/math64.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/math64.h Mon May 18 09:24:05 2020 (r361194) +++ stable/11/sys/compat/linuxkpi/common/include/linux/math64.h Mon May 18 09:24:36 2020 (r361195) @@ -91,4 +91,13 @@ mul_u32_u32(uint32_t a, uint32_t b) return ((uint64_t)a * b); } +static inline uint64_t +div64_u64_round_up(uint64_t dividend, uint64_t divisor) +{ + return ((dividend + divisor - 1) / divisor); +} + +#define DIV64_U64_ROUND_UP(...) \ + div64_u64_round_up(__VA_ARGS__) + #endif /* _LINUX_MATH64_H */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005180924.04I9Oas3064738>