From cd2295f93e11bb53696e5011b083b72d74cdf707 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 14 Oct 2014 09:28:32 +0200 Subject: BLI_bitmap: add a macro to set/clear the whole bitmap at once. --- source/blender/blenlib/BLI_bitmap.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/BLI_bitmap.h b/source/blender/blenlib/BLI_bitmap.h index 5431785aa84..594bf89b667 100644 --- a/source/blender/blenlib/BLI_bitmap.h +++ b/source/blender/blenlib/BLI_bitmap.h @@ -91,6 +91,16 @@ typedef unsigned int BLI_bitmap; BLI_BITMAP_DISABLE(_bitmap, _index); \ } (void)0 +/* set or clear the value of the whole bitmap (needs size info) */ +#define BLI_BITMAP_SET_ALL(_bitmap, _set, _tot) \ + { \ + CHECK_TYPE(_bitmap, BLI_bitmap *); \ + if (_set) \ + memset(_bitmap, UCHAR_MAX, BLI_BITMAP_SIZE(_tot)); \ + else \ + memset(_bitmap, 0, BLI_BITMAP_SIZE(_tot)); \ + } (void)0 + /* resize bitmap to have space for '_tot' bits */ #define BLI_BITMAP_RESIZE(_bitmap, _tot) \ { \ -- cgit v1.2.3