diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-12-09 12:01:44 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-12-09 12:01:44 +0300 |
commit | 9e365069afe156f33fadfad9705e1325f894cd54 (patch) | |
tree | 78373044d029feb51f987b45208e0c1a36958625 /source/blender/blenlib/BLI_bitmap.h | |
parent | d8b42751625c915113b64f5a2d9c72f19f009fee (diff) |
Cleanup: move public doc-strings into headers for 'blenlib'
- Added space below non doc-string comments to make it clear
these aren't comments for the symbols directly below them.
- Use doxy sections for some headers.
- Minor improvements to doc-strings.
Ref T92709
Diffstat (limited to 'source/blender/blenlib/BLI_bitmap.h')
-rw-r--r-- | source/blender/blenlib/BLI_bitmap.h | 59 |
1 files changed, 48 insertions, 11 deletions
diff --git a/source/blender/blenlib/BLI_bitmap.h b/source/blender/blenlib/BLI_bitmap.h index c97be6eed3c..b5ef08e9e60 100644 --- a/source/blender/blenlib/BLI_bitmap.h +++ b/source/blender/blenlib/BLI_bitmap.h @@ -40,26 +40,38 @@ typedef unsigned int BLI_bitmap; /* 0b11111 */ #define _BITMAP_MASK 31 -/* number of blocks needed to hold '_tot' bits */ +/** + * Number of blocks needed to hold '_tot' bits. + */ #define _BITMAP_NUM_BLOCKS(_tot) (((_tot) >> _BITMAP_POWER) + 1) -/* size (in bytes) used to hold '_tot' bits */ +/** + * Size (in bytes) used to hold '_tot' bits. + */ #define BLI_BITMAP_SIZE(_tot) ((size_t)(_BITMAP_NUM_BLOCKS(_tot)) * sizeof(BLI_bitmap)) -/* allocate memory for a bitmap with '_tot' bits; free with MEM_freeN() */ +/** + * Allocate memory for a bitmap with '_tot' bits; free with MEM_freeN(). + */ #define BLI_BITMAP_NEW(_tot, _alloc_string) \ ((BLI_bitmap *)MEM_callocN(BLI_BITMAP_SIZE(_tot), _alloc_string)) -/* allocate a bitmap on the stack */ +/** + * Allocate a bitmap on the stack. + */ #define BLI_BITMAP_NEW_ALLOCA(_tot) \ ((BLI_bitmap *)memset(alloca(BLI_BITMAP_SIZE(_tot)), 0, BLI_BITMAP_SIZE(_tot))) -/* Allocate using given MemArena */ +/** + * Allocate using given MemArena. + */ #define BLI_BITMAP_NEW_MEMARENA(_mem, _tot) \ (CHECK_TYPE_INLINE(_mem, MemArena *), \ ((BLI_bitmap *)BLI_memarena_calloc(_mem, BLI_BITMAP_SIZE(_tot)))) -/* get the value of a single bit at '_index' */ +/** + * Get the value of a single bit at '_index'. + */ #define BLI_BITMAP_TEST(_bitmap, _index) \ (CHECK_TYPE_ANY(_bitmap, BLI_bitmap *, const BLI_bitmap *), \ ((_bitmap)[(_index) >> _BITMAP_POWER] & (1u << ((_index)&_BITMAP_MASK)))) @@ -74,22 +86,30 @@ typedef unsigned int BLI_bitmap; (CHECK_TYPE_ANY(_bitmap, BLI_bitmap *, const BLI_bitmap *), \ (BLI_BITMAP_TEST(_bitmap, _index) != 0)) -/* set the value of a single bit at '_index' */ +/** + * Set the value of a single bit at '_index'. + */ #define BLI_BITMAP_ENABLE(_bitmap, _index) \ (CHECK_TYPE_ANY(_bitmap, BLI_bitmap *, const BLI_bitmap *), \ ((_bitmap)[(_index) >> _BITMAP_POWER] |= (1u << ((_index)&_BITMAP_MASK)))) -/* clear the value of a single bit at '_index' */ +/** + * Clear the value of a single bit at '_index'. + */ #define BLI_BITMAP_DISABLE(_bitmap, _index) \ (CHECK_TYPE_ANY(_bitmap, BLI_bitmap *, const BLI_bitmap *), \ ((_bitmap)[(_index) >> _BITMAP_POWER] &= ~(1u << ((_index)&_BITMAP_MASK)))) -/* flip the value of a single bit at '_index' */ +/** + * Flip the value of a single bit at '_index'. + */ #define BLI_BITMAP_FLIP(_bitmap, _index) \ (CHECK_TYPE_ANY(_bitmap, BLI_bitmap *, const BLI_bitmap *), \ ((_bitmap)[(_index) >> _BITMAP_POWER] ^= (1u << ((_index)&_BITMAP_MASK)))) -/* set or clear the value of a single bit at '_index' */ +/** + * Set or clear the value of a single bit at '_index'. + */ #define BLI_BITMAP_SET(_bitmap, _index, _set) \ { \ CHECK_TYPE(_bitmap, BLI_bitmap *); \ @@ -102,7 +122,9 @@ typedef unsigned int BLI_bitmap; } \ (void)0 -/* resize bitmap to have space for '_tot' bits */ +/** + * Resize bitmap to have space for '_tot' bits. + */ #define BLI_BITMAP_RESIZE(_bitmap, _tot) \ { \ CHECK_TYPE(_bitmap, BLI_bitmap *); \ @@ -110,10 +132,25 @@ typedef unsigned int BLI_bitmap; } \ (void)0 +/** + * Set or clear all bits in the bitmap. + */ void BLI_bitmap_set_all(BLI_bitmap *bitmap, bool set, size_t bits); +/** + * Invert all bits in the bitmap. + */ void BLI_bitmap_flip_all(BLI_bitmap *bitmap, size_t bits); +/** + * Copy all bits from one bitmap to another. + */ void BLI_bitmap_copy_all(BLI_bitmap *dst, const BLI_bitmap *src, size_t bits); +/** + * Combine two bitmaps with boolean AND. + */ void BLI_bitmap_and_all(BLI_bitmap *dst, const BLI_bitmap *src, size_t bits); +/** + * Combine two bitmaps with boolean OR. + */ void BLI_bitmap_or_all(BLI_bitmap *dst, const BLI_bitmap *src, size_t bits); #ifdef __cplusplus |