- Added More Documentation

Going to continue passes on documentation before implementing more functions of the standard library.
This commit is contained in:
2025-06-16 16:54:44 -04:00
parent 1c67c13a27
commit 079b0b27ee
8 changed files with 168 additions and 49 deletions

View File

@@ -28,10 +28,56 @@
///
///
#ifndef FENNEC_LANG_BITS_H
#define FENNEC_LANG_BITS_H
///
/// \page fennec_lang_bit_manipulation Bit Manipulation
///
/// This header contains definitions for manipulating the bits of a provided object or pointer.
///
/// <table width="100%" class="fieldtable" id="table_fennec_math_common_sign_functions">
/// <tr><th style="vertical-align: top">Syntax
/// <th style="vertical-align: top">Description
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::bit_cast "ToT bit_cast(const FromT& x)"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::bit_cast
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::bit_and "void* bit_and(void* arr, const void* mask, size_t n)"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::bit_and
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::bit_and_s "void* bit_and_s(void* arr, size_t n0, const void* mask, size_t n1)"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::bit_and_s
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::bit_or "void* bit_or(void* arr, const void* mask, size_t n)"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::bit_or
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::bit_or_s "void* bit_or_s(void* arr, size_t n0, const void* mask, size_t n1)"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::bit_or_s
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::bit_xor "void* bit_xor(void* arr, const void* mask, size_t n)"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::bit_xor
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::bit_xor_s "void* bit_xor_s(void* arr, size_t n0, const void* mask, size_t n1)"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::bit_xor_s
/// </table>
///
///
#include <fennec/lang/intrinsics.h>
#include <fennec/memory/memory.h>
#include <fennec/lang/detail/__bits.h>
@@ -40,11 +86,13 @@ namespace fennec
{
///
/// \brief perform a bitcast of FromT to ToT
/// \brief Perform a bitcast of FromT to ToT
///
/// \details Perform a bitcast of FromT to ToT
/// \tparam ToT Type to cast to
/// \tparam FromT Type of the value
/// \param from Value to bit cast
/// \return A value containing a bitwise copy of the input
/// \returns A value containing a bitwise copy of the input
template<typename ToT, typename FromT> requires(sizeof(ToT) == sizeof(FromT))
constexpr ToT bit_cast(const FromT& from)
{
@@ -63,11 +111,13 @@ constexpr ToT bit_cast(const FromT& from)
///
/// \brief perform a bit-wise and over an array of bytes
/// \brief Perform a bit-wise and over an array of bytes
///
/// \details Perform a bitcast of FromT to ToT
/// \param arr the array of bytes to modify
/// \param mask the mask to and against arr
/// \param n the number of bytes
/// \returns the pointer arr
/// \returns the pointer \f$arr\f$
constexpr void* bit_and(void* arr, const void* mask, size_t n)
{
if (arr == mask) return arr;
@@ -84,8 +134,10 @@ constexpr void* bit_and(void* arr, const void* mask, size_t n)
}
///
/// \brief safe version of fennec::bit_and
/// \copydoc fennec::bit_and
/// \brief Safe version of fennec::bit_and
///
/// \details Safe version of fennec::bit_and
/// \copydetails fennec::bit_and
/// \param n0 the size of arr in bytes
/// \param n1 the size of mask in bytes
constexpr void* bit_and_s(void* arr, size_t n0, const void* mask, size_t n1)
@@ -96,7 +148,9 @@ constexpr void* bit_and_s(void* arr, size_t n0, const void* mask, size_t n1)
///
/// \brief perform a bit-wise or over an array of bytes
/// \brief Perform a bit-wise or over an array of bytes
///
/// \details Perform a bit-wise or over an array of bytes
/// \param arr the array of bytes to modify
/// \param mask the mask to or against arr
/// \param n the number of bytes
@@ -117,8 +171,10 @@ constexpr void* bit_or(void* arr, const void* mask, size_t n)
}
///
/// \brief safe version of fennec::bit_or
/// \copydoc fennec::bit_or
/// \brief Safe version of fennec::bit_or
///
/// \details Safe version of fennec::bit_or
/// \copydetails fennec::bit_or
/// \param n0 the size of arr in bytes
/// \param n1 the size of mask in bytes
constexpr void* bit_or_s(void* arr, size_t n0, const void* mask, size_t n1)
@@ -129,7 +185,9 @@ constexpr void* bit_or_s(void* arr, size_t n0, const void* mask, size_t n1)
///
/// \brief perform a bit-wise or over an array of bytes
/// \brief Perform a bit-wise or over an array of bytes
///
/// \details Perform a bit-wise or over an array of bytes
/// \param arr the array of bytes to modify
/// \param mask the mask to or against arr
/// \param n the number of bytes
@@ -150,8 +208,10 @@ constexpr void* bit_xor(void* arr, const void* mask, size_t n)
}
///
/// \brief safe version of fennec::bit_xor
/// \copydoc fennec::bit_xor
/// \brief Safe version of fennec::bit_xor
///
/// \details Safe version of fennec::bit_xor
/// \copydetails fennec::bit_xor
/// \param n0 the size of arr in bytes
/// \param n1 the size of mask in bytes
constexpr void* bit_xor_s(void* arr, size_t n0, const void* mask, size_t n1)