diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-03-28 09:59:26 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-03-28 12:13:54 +0300 |
commit | a970ac5d556a5a342855a8586c50c8ec539ecbd8 (patch) | |
tree | a07320c1fbdb43aebeaf5743fc770aa69eb1a0a4 /source/blender/blenlib/intern/array_utils.c | |
parent | 4bd5b824b08823d2ed26161a7260672411efddd2 (diff) |
BLI_array: utility to check memory is zerod
Diffstat (limited to 'source/blender/blenlib/intern/array_utils.c')
-rw-r--r-- | source/blender/blenlib/intern/array_utils.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/array_utils.c b/source/blender/blenlib/intern/array_utils.c index 32f0111babd..e407a92d6f6 100644 --- a/source/blender/blenlib/intern/array_utils.c +++ b/source/blender/blenlib/intern/array_utils.c @@ -308,3 +308,20 @@ bool _bli_array_iter_span( return false; } + +/** + * Simple utility to check memory is zero'd. + */ +bool _bli_array_is_zerod( + const void *arr_v, + unsigned int arr_len, size_t arr_stride) +{ + const char *arr_step = (const char *)arr_v; + size_t i = arr_stride * arr_len; + while (i--) { + if (*(arr_step++)) { + return false; + } + } + return true; +} |