diff options
| author | riastradh <riastradh@NetBSD.org> | 2021-12-19 11:48:34 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2021-12-19 11:48:34 +0000 |
| commit | 05ab70159101044d3472f784878050af688d555d (patch) | |
| tree | ebaf704276c7cb8b5c7d8e1f98fc3951a6fea3a4 /sys/external/bsd/drm2/include/linux | |
| parent | 7035ebaeb04b1fb4e2ac9668fbc4e7e6e33eb2f4 (diff) | |
Provide not-quite-proper mul_u64_u32_div
Author: Maya Rashish <maya@NetBSD.org>
Committer: Taylor R Campbell <riastradh@NetBSD.org>
Diffstat (limited to 'sys/external/bsd/drm2/include/linux')
| -rw-r--r-- | sys/external/bsd/drm2/include/linux/math64.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/external/bsd/drm2/include/linux/math64.h b/sys/external/bsd/drm2/include/linux/math64.h index 84cf18d03db..352c205b0f2 100644 --- a/sys/external/bsd/drm2/include/linux/math64.h +++ b/sys/external/bsd/drm2/include/linux/math64.h @@ -1,4 +1,4 @@ -/* $NetBSD: math64.h,v 1.11 2021/12/19 11:36:57 riastradh Exp $ */ +/* $NetBSD: math64.h,v 1.12 2021/12/19 11:48:34 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -88,6 +88,13 @@ mul_u32_u32(uint32_t a, uint32_t b) return (uint64_t)a * (uint64_t)b; } +static inline uint64_t +mul_u64_u32_div(uint64_t a, uint32_t b, uint32_t div) +{ + /* XXX implement to account for overflow */ + return (a * b) / div; +} + /* return floor((a*b) / 2^c) */ static inline uint64_t mul_u64_u32_shr(uint64_t a, uint32_t b, unsigned c) |
