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 Name bpl in bitmap_and/o...



details:   https://anonhg.NetBSD.org/src/rev/d1cb40d1e89b
branches:  trunk
changeset: 364794:d1cb40d1e89b
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 14:50:37 2018 +0000

description:
Name bpl in bitmap_and/or.  Fix and clarify comments.

diffstat:

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

diffs (47 lines):

diff -r c35bc02e0d61 -r d1cb40d1e89b sys/external/bsd/drm2/include/linux/bitmap.h
--- a/sys/external/bsd/drm2/include/linux/bitmap.h      Mon Aug 27 14:50:24 2018 +0000
+++ b/sys/external/bsd/drm2/include/linux/bitmap.h      Mon Aug 27 14:50:37 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bitmap.h,v 1.4 2018/08/27 14:50:24 riastradh Exp $     */
+/*     $NetBSD: bitmap.h,v 1.5 2018/08/27 14:50:37 riastradh Exp $     */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -144,30 +144,32 @@
  *
  *     Set dst to be the bitwise AND of src1 and src2, all bitmaps
  *     allocated to have nbits bits.  Yes, this modifies bits past
- *     nbits.
+ *     nbits.  Any pair of {dst, src1, src2} may be aliases.
  */
 static inline void
 bitmap_and(unsigned long *dst, const unsigned long *src1,
     const unsigned long *src2, size_t nbits)
 {
-       size_t n = howmany(nbits, NBBY * sizeof(unsigned long));
+       const size_t bpl = NBBY * sizeof(unsigned long);
+       size_t n = howmany(nbits, bpl);
 
        while (n --> 0)
                *dst++ = *src1++ & *src2++;
 }
 
 /*
- * bitmap_and(dst, src1, src2, nbits)
+ * bitmap_or(dst, src1, src2, nbits)
  *
  *     Set dst to be the bitwise inclusive-OR of src1 and src2, all
  *     bitmaps allocated to have nbits bits.  Yes, this modifies bits
- *     past nbits.
+ *     past nbits.  Any pair of {dst, src1, src2} may be aliases.
  */
 static inline void
 bitmap_or(unsigned long *dst, const unsigned long *src1,
     const unsigned long *src2, size_t nbits)
 {
-       size_t n = howmany(nbits, NBBY * sizeof(unsigned long));
+       const size_t bpl = NBBY * sizeof(unsigned long);
+       size_t n = howmany(nbits, bpl);
 
        while (n --> 0)
                *dst++ = *src1++ | *src2++;



Home | Main Index | Thread Index | Old Index