Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/include/linux Provide not-quite-proper...



details:   https://anonhg.NetBSD.org/src/rev/092fe99da9df
branches:  trunk
changeset: 1028705:092fe99da9df
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 11:48:34 2021 +0000

description:
Provide not-quite-proper mul_u64_u32_div


Author: Maya Rashish <maya%NetBSD.org@localhost>
Committer: Taylor R Campbell <riastradh%NetBSD.org@localhost>

diffstat:

 sys/external/bsd/drm2/include/linux/math64.h |  9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diffs (23 lines):

diff -r 223530a7dc3e -r 092fe99da9df sys/external/bsd/drm2/include/linux/math64.h
--- a/sys/external/bsd/drm2/include/linux/math64.h      Sun Dec 19 11:48:27 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/math64.h      Sun Dec 19 11:48:34 2021 +0000
@@ -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 @@
        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)



Home | Main Index | Thread Index | Old Index