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 bitmap_complement



details:   https://anonhg.NetBSD.org/src/rev/7d2bea7baa86
branches:  trunk
changeset: 1028398:7d2bea7baa86
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 10:57:19 2021 +0000

description:
bitmap_complement

diffstat:

 sys/external/bsd/drm2/include/linux/bitmap.h |  17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diffs (31 lines):

diff -r f55668987538 -r 7d2bea7baa86 sys/external/bsd/drm2/include/linux/bitmap.h
--- a/sys/external/bsd/drm2/include/linux/bitmap.h      Sun Dec 19 10:57:12 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/bitmap.h      Sun Dec 19 10:57:19 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bitmap.h,v 1.8 2018/08/27 14:52:16 riastradh Exp $     */
+/*     $NetBSD: bitmap.h,v 1.9 2021/12/19 10:57:19 riastradh Exp $     */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -165,6 +165,21 @@
 }
 
 /*
+ * bitmap_complement(dst, src, nbits)
+ *
+ *     Set dst to the the bitwise NOT of src.  dst and src may alias.
+ */
+static inline void
+bitmap_complement(unsigned long *dst, const unsigned long *src, size_t nbits)
+{
+       const size_t bpl = NBBY * sizeof(unsigned long);
+       size_t n = howmany(nbits, bpl);
+
+       while (n --> 0)
+               *dst++ = ~*src++;
+}
+
+/*
  * bitmap_and(dst, src1, src2, nbits)
  *
  *     Set dst to be the bitwise AND of src1 and src2, all bitmaps



Home | Main Index | Thread Index | Old Index