Functions for setting a blocks of memory to a fixed value, providing a uniform alternative to the C functions memset/memfill/bzero. More...
#include "std.h"
Macros | |
#define | SIMPLEST_MEMSET 0 |
#define | HqMemSet8(_p, _v, _c) |
#define | HqMemSet16(_p, _v, _c) |
#define | HqMemSet32(_p, _v, _c) |
#define | HqMemSet64(_p, _v, _c) |
#define | HqMemSetPtr(_p, _v, _c) HqMemSet64((uint64 *)(char *)(_p), (uint64)(uintptr_t)(_v), (_c)) |
#define | HqMemNullPtr(_p, _c) HqMemSet64((uint64 *)(char *)(_p), (uint64)(uintptr_t)(NULL), (_c)) |
#define | HqMemZero(_p, _c) HqMemSet8_f((uint8 *)(_p), (uint8)0, (size_t)(_c)) |
Functions | |
void | HqMemSet8_f (uint8 *ptr, uint8 val, size_t count) |
void | HqMemSet16_f (uint16 *ptr, uint16 val, size_t count) |
void | HqMemSet32_f (uint32 *ptr, uint32 val, size_t count) |
void | HqMemSet64_f (uint64 *ptr, uint64 val, size_t count) |
Functions for setting a blocks of memory to a fixed value, providing a uniform alternative to the C functions memset/memfill/bzero.
On some platforms they map onto those functions. On others, they call out to the OS, or execute our own optimised routines. The decision of which to use on each platform should be based on careful testing.
Memset-like functionality has been found to be a rip bottleneck for many different types of jobs on many different platforms. Its execution is therefore often time critical. Therefore a suite of functions that can be optimised on a per platform/build basis is important. But they will be called a huge number of times from bit-setting code, so even the function call overhead can be important. Thus the API is actually implemented as a set of macros, so it is guaranteed the code can be placed inline where appropriate.
Copyright (C) 2023 Global Graphics Software Ltd. All rights reserved. This source code contains the confidential and trade secret information of Global Graphics Software Ltd. It may not be used, copied or distributed for any reason except as set forth in the applicable Global Graphics license agreement.