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

Bit Manipulation More...

#include <fennec/lang/intrinsics.h>
#include <fennec/memory/common.h>
#include <fennec/lang/detail/_bits.h>

Go to the source code of this file.

Detailed Description

Author
Medusa Slockbower

Functions

template<typename ToT , typename FromT >
requires (sizeof(ToT) == sizeof(FromT))
constexpr ToT fennec::bit_cast (const FromT &from)
 Perform a bitcast of FromT to ToT.
 
constexpr void * fennec::bit_and (void *arr, const void *mask, size_t n)
 Perform a bit-wise and over an array of bytes.
 
constexpr void * fennec::bit_and_s (void *arr, size_t n0, const void *mask, size_t n1)
 Safe version of fennec::bit_and.
 
constexpr void * fennec::bit_or (void *arr, const void *mask, size_t n)
 Perform a bit-wise or over an array of bytes.
 
constexpr void * fennec::bit_or_s (void *arr, size_t n0, const void *mask, size_t n1)
 Safe version of fennec::bit_or.
 
constexpr void * fennec::bit_xor (void *arr, const void *mask, size_t n)
 Perform a bit-wise or over an array of bytes.
 
constexpr void * fennec::bit_xor_s (void *arr, size_t n0, const void *mask, size_t n1)
 Safe version of fennec::bit_xor.
 

Function Documentation

◆ bit_cast()

template<typename ToT , typename FromT >
requires (sizeof(ToT) == sizeof(FromT))
constexpr ToT fennec::bit_cast ( const FromT &  from)
constexpr

Perform a bitcast of FromT to ToT

Template Parameters
ToTType to cast to
FromTType of the value
Parameters
fromValue to bit cast
Returns
A value containing a bitwise copy of the input

◆ bit_and()

constexpr void * fennec::bit_and ( void *  arr,
const void *  mask,
size_t  n 
)
constexpr

Perform a bitcast of FromT to ToT

Parameters
arrthe array of bytes to modify
maskthe mask to and against arr
nthe number of bytes
Returns
the pointer \(arr\)

◆ bit_and_s()

constexpr void * fennec::bit_and_s ( void *  arr,
size_t  n0,
const void *  mask,
size_t  n1 
)
constexpr

Safe version of fennec::bit_and

Parameters
arrthe array of bytes to modify
n0the size of arr in bytes
maskthe mask to and against arr
n1the size of mask in bytes
Returns
the pointer arr

◆ bit_or()

constexpr void * fennec::bit_or ( void *  arr,
const void *  mask,
size_t  n 
)
constexpr

Perform a bit-wise or over an array of bytes

Parameters
arrthe array of bytes to modify
maskthe mask to or against arr
nthe number of bytes
Returns
the pointer arr

◆ bit_or_s()

constexpr void * fennec::bit_or_s ( void *  arr,
size_t  n0,
const void *  mask,
size_t  n1 
)
constexpr

Safe version of fennec::bit_or

Parameters
arrthe array of bytes to modify
n0the size of arr in bytes
maskthe mask to or against arr
n1the size of mask in bytes
Returns
the pointer arr

◆ bit_xor()

constexpr void * fennec::bit_xor ( void *  arr,
const void *  mask,
size_t  n 
)
constexpr

Perform a bit-wise or over an array of bytes

Parameters
arrthe array of bytes to modify
maskthe mask to or against arr
nthe number of bytes
Returns
the pointer arr

◆ bit_xor_s()

constexpr void * fennec::bit_xor_s ( void *  arr,
size_t  n0,
const void *  mask,
size_t  n1 
)
constexpr

Safe version of fennec::bit_xor

Parameters
arrthe array of bytes to modify
n0the size of arr in bytes
maskthe mask to or against arr
n1the size of mask in bytes
Returns
the pointer arr