Module Name:    src
Committed By:   riastradh
Date:           Mon Aug 27 14:50:37 UTC 2018

Modified Files:
        src/sys/external/bsd/drm2/include/linux: bitmap.h

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


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/include/linux/bitmap.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/linux/bitmap.h
diff -u src/sys/external/bsd/drm2/include/linux/bitmap.h:1.4 src/sys/external/bsd/drm2/include/linux/bitmap.h:1.5
--- src/sys/external/bsd/drm2/include/linux/bitmap.h:1.4	Mon Aug 27 14:50:24 2018
+++ src/sys/external/bsd/drm2/include/linux/bitmap.h	Mon Aug 27 14:50:37 2018
@@ -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 @@ bitmap_clear(unsigned long *bitmap, size
  *
  *	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++;

Reply via email to