Welcome to mirror list, hosted at ThFree Co, Russian Federation.

memory_utils.c « intern « blenlib « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: abfc4d9d4193c0f390217e9e5b62b9d3f76ae685 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* SPDX-License-Identifier: GPL-2.0-or-later */

/** \file
 * \ingroup bli
 * \brief Generic memory manipulation API.
 *
 * This is to extend on existing functions
 * such as `memcpy` & `memcmp`.
 */
#include <string.h>

#include "BLI_sys_types.h"
#include "BLI_utildefines.h"

#include "BLI_memory_utils.h"

#include "BLI_strict_flags.h"

bool BLI_memory_is_zero(const void *arr, const size_t arr_size)
{
  const char *arr_byte = arr;
  const char *arr_end = (const char *)arr + arr_size;

  while ((arr_byte != arr_end) && (*arr_byte == 0)) {
    arr_byte++;
  }

  return (arr_byte == arr_end);
}