51#ifndef __R_MEM_OPS_H__
52#define __R_MEM_OPS_H__
54#if !defined(__RLIB_H_INCLUDE_GUARD__) && !defined(RLIB_COMPILATION)
55#error "#include <rlib.h> only please."
78 if (R_UNLIKELY (a ==
NULL))
return -(a != b);
79 if (R_UNLIKELY (b ==
NULL))
return a != b;
80 return memcmp (a, b, size);
105#define r_memclear(ptr, size) r_memset (ptr, 0, size)
125 return memcpy (dst, src, size);
145 return memmove (dst, src, size);
#define NULL
Null pointer constant (defined only if absent).
Definition rmacros.h:126
#define R_ATTR_RESTRICT
Pointer-aliasing hint (restrict) in the compiler's spelling.
Definition rmacros.h:354
#define R_BEGIN_DECLS
Open an extern "C" block under C++ (no-op in C).
Definition rmacros.h:196
static rpointer r_memset(rpointer a, int v, rsize size)
Fill size bytes at a with byte value v.
Definition rmemops.h:97
static rpointer r_memmove(rpointer dst, rconstpointer src, rsize size)
Copy size bytes from src to dst, allowing overlap.
Definition rmemops.h:142
static int r_memcmp(rconstpointer a, rconstpointer b, rsize size)
Lexicographically compare size bytes of a and b.
Definition rmemops.h:76
static rpointer r_memcpy(void *R_ATTR_RESTRICT dst, const void *R_ATTR_RESTRICT src, rsize size)
Copy size bytes from src to dst.
Definition rmemops.h:121
void * rpointer
Generic pointer (alias for void *).
Definition rtypes.h:327
const void * rconstpointer
Generic const pointer (alias for const void *).
Definition rtypes.h:329
unsigned long rsize
Unsigned pointer-sized size type (like size_t).
Definition rtypes.h:290