Module Name: src Committed By: riastradh Date: Sun Dec 19 10:57:19 UTC 2021
Modified Files: src/sys/external/bsd/drm2/include/linux: bitmap.h Log Message: bitmap_complement To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 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.8 src/sys/external/bsd/drm2/include/linux/bitmap.h:1.9 --- src/sys/external/bsd/drm2/include/linux/bitmap.h:1.8 Mon Aug 27 14:52:16 2018 +++ src/sys/external/bsd/drm2/include/linux/bitmap.h Sun Dec 19 10:57:19 2021 @@ -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_clear(unsigned long *bitmap, size } /* + * 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