fennec
Loading...
Searching...
No Matches
common.h File Reference

This header contains functions related to analyzing, modifying or copying buffers interpreted as bytes. More...

#include <fennec/lang/type_traits.h>
#include <fennec/memory/detail/_string.h>

Go to the source code of this file.

Detailed Description

Author
Medusa Slockbower

Functions

template<typename TypeT >
constexpr TypeT * fennec::addressof (TypeT &obj)
 Returns the address of an object regardless of whether the & operators is implemented.
 
constexpr int fennec::memcmp_s (const void *lhs, size_t n0, const void *rhs, size_t n1)
 Safe version of memcmp.
 
constexpr void * fennec::memcpy_s (void *dst, size_t n0, const void *src, size_t n1)
 Safe version of memcpy.
 
constexpr void * fennec::memmove_s (void *dst, size_t n0, const void *src, size_t n1)
 Safe version of memmove.
 

Function Documentation

◆ addressof()

template<typename TypeT >
constexpr TypeT * fennec::addressof ( TypeT &  obj)
constexpr
Template Parameters
TypeTThe type of the objects
Parameters
objThe object to find the address of
Returns
The true address of the

◆ memcmp_s()

constexpr int fennec::memcmp_s ( const void *  lhs,
size_t  n0,
const void *  rhs,
size_t  n1 
)
constexpr
Parameters
lhsThe first object, interpreted as an array of bytes
rhsThe second object, interpreted as an array of bytes
n0The size, in bytes, of lhs
n1The size, in bytes, of rhs
Returns
\(0\) if the first \(min(n0, n1)\) bytes of \(lhs\) and \(rhs\) are equivalent. Otherwise, returns \(1\) for the first byte \(b\) where \(lhs[b] > \) rhs[b] \(, and \)-1 \( for \)

◆ memcpy_s()

constexpr void * fennec::memcpy_s ( void *  dst,
size_t  n0,
const void *  src,
size_t  n1 
)
constexpr
Parameters
dstThe destination object, interpreted as an array of bytes
srcThe source object, interpreted as an array of bytes
n0The size, in bytes, of dst
n1The size, in bytes, of src
Returns
\(dst\)

◆ memmove_s()

constexpr void * fennec::memmove_s ( void *  dst,
size_t  n0,
const void *  src,
size_t  n1 
)
constexpr
Parameters
dstThe destination object, interpreted as an array of bytes
srcThe source object, interpreted as an array of bytes
n0The size, in bytes, of dst
n1The size, in bytes, of src
Returns
\(dst\)