Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd Define DIV_ROUND_CLOSEST_ULL and div_s64.



details:   https://anonhg.NetBSD.org/src/rev/6150684377ff
branches:  trunk
changeset: 365866:6150684377ff
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 07:02:51 2018 +0000

description:
Define DIV_ROUND_CLOSEST_ULL and div_s64.

diffstat:

 sys/external/bsd/common/include/linux/kernel.h |  4 +++-
 sys/external/bsd/drm2/include/linux/math64.h   |  8 +++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diffs (40 lines):

diff -r 0b4a71fab2cc -r 6150684377ff sys/external/bsd/common/include/linux/kernel.h
--- a/sys/external/bsd/common/include/linux/kernel.h    Mon Aug 27 07:02:41 2018 +0000
+++ b/sys/external/bsd/common/include/linux/kernel.h    Mon Aug 27 07:02:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kernel.h,v 1.16 2018/08/27 06:55:32 riastradh Exp $    */
+/*     $NetBSD: kernel.h,v 1.17 2018/08/27 07:02:51 riastradh Exp $    */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -86,6 +86,8 @@
        ((0 < (N)) ? (((N) + ((D) / 2)) / (D))                          \
            : (((N) - ((D) / 2)) / (D)))
 
+#define        DIV_ROUND_CLOSEST_ULL(N, D)     (((N) + (D)/2)/(D))
+
 /*
  * Rounding to what may or may not be powers of two.
  */
diff -r 0b4a71fab2cc -r 6150684377ff sys/external/bsd/drm2/include/linux/math64.h
--- a/sys/external/bsd/drm2/include/linux/math64.h      Mon Aug 27 07:02:41 2018 +0000
+++ b/sys/external/bsd/drm2/include/linux/math64.h      Mon Aug 27 07:02:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: math64.h,v 1.5 2018/08/27 06:51:07 riastradh Exp $     */
+/*     $NetBSD: math64.h,v 1.6 2018/08/27 07:02:51 riastradh Exp $     */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -54,6 +54,12 @@
        return dividend / divisor;
 }
 
+static inline int64_t
+div_s64(int64_t dividend, int32_t divisor)
+{
+       return dividend / divisor;
+}
+
 static inline uint64_t
 div64_u64_rem(uint64_t dividend, uint64_t divisor, uint64_t *rem)
 {



Home | Main Index | Thread Index | Old Index