- Added More Documentation

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

View File

@ -815,7 +815,7 @@ FILE_VERSION_FILTER =
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
# tag is left empty.
LAYOUT_FILE =
LAYOUT_FILE = /home/medusa/Documents/Work/Personal/fennec/doxy/DoxyLayout.xml
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
# the reference definitions. This must be a list of .bib files. The .bib

View File

@ -815,7 +815,7 @@ FILE_VERSION_FILTER =
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
# tag is left empty.
LAYOUT_FILE =
LAYOUT_FILE = @PROJECT_SOURCE_DIR@/doxy/DoxyLayout.xml
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
# the reference definitions. This must be a list of .bib files. The .bib

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)

View File

@ -32,6 +32,28 @@
#ifndef FENNEC_LANG_CONDITIONAL_TYPES_H
#define FENNEC_LANG_CONDITIONAL_TYPES_H
///
/// \page fennec_lang_conditional_types Conditional Types
///
/// <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::conditional "conditional<bool_t B, TrueT, FalseT>::type"<br>
/// \ref fennec::conditional_t "conditional_t<bool_t B, TrueT, FalseT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::conditional
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::detect "detect<DefaultT, DetectT<...>, ArgsT...>::type"<br>
/// \ref fennec::detect_t "detect_t<DefaultT, DetectT<...>, ArgsT...>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::detect
/// </table>
///
///
#include <fennec/lang/type_transforms.h>
#include <fennec/lang/types.h>
@ -44,19 +66,20 @@ namespace fennec
///
/// \brief select between two types based on a condition
///
/// \details
/// \details Selects between \p TrueT and \p FalseT based on the boolean value \p b.
/// The chosen type is stored in `conditional::type`.
/// \tparam B the value of the condition
/// \tparam T type to use when \f$B == true\f$
/// \tparam F type to use when \f$B == false\f$
template<bool_t B, typename T, typename F>
/// \tparam TrueT type to use when \f$B == true\f$
/// \tparam FalseT type to use when \f$B == false\f$
template<bool_t B, typename TrueT, typename FalseT>
struct conditional;
///
/// \brief Shorthand for ```typename conditional<ConditionV, TrueT, FalseT>::type```
template<bool_t B, typename T, typename F>
template<bool_t B, typename TrueT, typename FalseT>
using conditional_t
= typename conditional<B, T, F>::type;
= typename conditional<B, TrueT, FalseT>::type;
// specialization of fennec::conditional for `true` case
@ -76,8 +99,8 @@ struct conditional<false, T, F>
///
/// \brief Detect whether `DetectT<ArgsT...>` is a valid type
///
/// \details The chosen type is stored in `detect::type` and
/// a boolean value is stored in `detect::is_detected` representing whether `DetectT<ArgsT>`
/// \details Selects `DetectT<ArgsT...>` if it exists, otherwise selects `DefaultT` The chosen type is stored in `detect::type` and
/// a boolean value is stored in `detect::is_detected` representing whether `DetectT<ArgsT...>` is found.
/// \tparam DefaultT Default type
/// \tparam DetectT Type to detect
/// \tparam ArgsT Any template arguments for `DetectT<ArgsT>`
@ -102,6 +125,9 @@ struct detect<DefaultT, DetectT, ArgsT...>
{
using type = DetectT<ArgsT...>;
static constexpr bool is_detected = true;
// fennec::enable_if ===================================================================================================
};
}

View File

@ -36,7 +36,20 @@
///
/// This library implements the parts of the C++ stdlib that relate to built-in types and metaprogramming.
///
/// \subpage
/// - \subpage fennec_lang_bit_manipulation
/// - \subpage fennec_lang_metaprogramming
///
///
///
/// \page fennec_lang_metaprogramming Metaprogramming
///
/// Metaprogramming is a method of obtaining information about the structure of the code at compile time.
/// This includes getting traits of types, such as with \ref fennec::numeric_limits. You may even programmatically
/// enable functions based on the info of the types that the function uses.
///
/// - \subpage fennec_lang_conditional_types
///
///
///

View File

@ -51,37 +51,37 @@
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::pow(fennec::genType, fennec::genType) "genFType pow(genFType x, genFType y)"
/// <td width="50%" style="vertical-align: top">
/// \copydoc fennec::pow(fennec::genType, fennec::genType)
/// \copydetails fennec::pow(fennec::genType, fennec::genType)
///
/// <tr><td width="50%" style="vertical-align: top" class="odd_c"> <br>
/// \ref fennec::exp(fennec::genType)"genFType exp(genFType x)"
/// <td width="50%" style="vertical-align: top" class="odd_c">
/// \copydoc fennec::exp(fennec::genType)
/// \copydetails fennec::exp(fennec::genType)
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::exp2(fennec::genType) "genFType exp2(genFType x)"
/// <td width="50%" style="vertical-align: top">
/// \copydoc fennec::exp2(fennec::genType)
/// \copydetails fennec::exp2(fennec::genType)
///
/// <tr><td width="50%" style="vertical-align: top" class="odd_c"> <br>
/// \ref fennec::log(fennec::genType) "genFType log(genFType x)"
/// <td width="50%" style="vertical-align: top" class="odd_c">
/// \copydoc fennec::log(fennec::genType)
/// \copydetails fennec::log(fennec::genType)
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::log2(fennec::genType) "genFType log2(genFType x)"
/// <td width="50%" style="vertical-align: top">
/// \copydoc fennec::log2(fennec::genType)
/// \copydetails fennec::log2(fennec::genType)
///
/// <tr><td width="50%" style="vertical-align: top" class="odd_c"> <br>
/// \ref fennec::sqrt(fennec::genType) "genFType sqrt(genFType x)"
/// <td width="50%" style="vertical-align: top" class="odd_c">
/// \copydoc fennec::sqrt(fennec::genType)
/// \copydetails fennec::sqrt(fennec::genType)
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::inversesqrt(fennec::genType) "genFType inversesqrt(genFType x)"
/// <td width="50%" style="vertical-align: top">
/// \copydoc fennec::inversesqrt(fennec::genType)
/// \copydetails fennec::inversesqrt(fennec::genType)
///
/// </table>
///

View File

@ -45,27 +45,43 @@
/// The overarching goal of this math library is to implement the math types and functions of the
/// [OpenGL 4.6 Shading Language Specification](https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf).
///
/// \section fennec_math_topics Topics
/// - \subpage fennec_math_topics "Topics"
/// - \ref fennec_math_set_theory
/// - \subpage fennec_math_data_types "Data Types"
/// - \ref fennec_math_scalar
/// - \ref fennec_math_vector
/// - \ref fennec_math_matrix
/// - \subpage fennec_math_functions "Functions"
/// - \ref fennec_math_set_theory
/// - \ref fennec_math_common
/// - \ref fennec_math_exponential
/// - \ref fennec_math_geometric
/// - \ref fennec_math_relational
/// - \ref fennec_math_trigonometric
///
///
///
/// \page fennec_math_topics Topics
/// - \subpage fennec_math_set_theory
///
/// \section fennec_math_data_types Data Types
///
/// \page fennec_math_data_types Data Types
/// - \subpage fennec_math_scalar
/// - \subpage fennec_math_vector
/// - \subpage fennec_math_matrix
///
/// \section fennec_math_functions Functions
///
/// \page fennec_math_functions Functions
/// - \subpage fennec_math_set_theory
/// - \subpage fennec_math_common
/// - \subpage fennec_math_exponential
/// - \subpage fennec_math_geometric
/// - \subpage fennec_math_relational
/// - \subpage fennec_math_trigonometric
///
///
///
///
///

View File

@ -48,7 +48,7 @@
/// \ref fennec::lessThan "bvec lessThan(ivec x, ivec y)"<br>
/// \ref fennec::lessThan "bvec lessThan(uvec x, uvec y)"
/// <td width="50%" style="vertical-align: top">
/// \copydoc fennec::lessThan
/// \copydetails fennec::lessThan
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::lessThanEqual "bvec lessThanEqual(vec x, vec y)"<br>
@ -56,7 +56,7 @@
/// \ref fennec::lessThanEqual "bvec lessThanEqual(ivec x, ivec y)"<br>
/// \ref fennec::lessThanEqual "bvec lessThanEqual(uvec x, uvec y)"
/// <td width="50%" style="vertical-align: top">
/// \copydoc fennec::lessThanEqual
/// \copydetails fennec::lessThanEqual
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::greaterThan "bvec greaterThan(vec x, vec y)"<br>
@ -64,7 +64,7 @@
/// \ref fennec::greaterThan "bvec greaterThan(ivec x, ivec y)"<br>
/// \ref fennec::greaterThan "bvec greaterThan(uvec x, uvec y)"
/// <td width="50%" style="vertical-align: top">
/// \copydoc fennec::greaterThan
/// \copydetails fennec::greaterThan
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::greaterThanEqual "bvec greaterThanEqual(vec x, vec y)"<br>
@ -72,7 +72,7 @@
/// \ref fennec::greaterThanEqual "bvec greaterThanEqual(ivec x, ivec y)"<br>
/// \ref fennec::greaterThanEqual "bvec greaterThanEqual(uvec x, uvec y)"
/// <td width="50%" style="vertical-align: top">
/// \copydoc fennec::greaterThanEqual
/// \copydetails fennec::greaterThanEqual
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::equal "bvec equal(vec x, vec y)"<br>
@ -80,7 +80,7 @@
/// \ref fennec::equal "bvec equal(ivec x, ivec y)"<br>
/// \ref fennec::equal "bvec equal(uvec x, uvec y)"
/// <td width="50%" style="vertical-align: top">
/// \copydoc fennec::equal
/// \copydetails fennec::equal
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::notEqual "bvec notEqual(vec x, vec y)"<br>
@ -88,22 +88,25 @@
/// \ref fennec::notEqual "bvec notEqual(ivec x, ivec y)"<br>
/// \ref fennec::notEqual "bvec notEqual(uvec x, uvec y)"
/// <td width="50%" style="vertical-align: top">
/// \copydoc fennec::notEqual
/// \copydetails fennec::notEqual
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::any "bool any(bvec x)"<br>
/// <td width="50%" style="vertical-align: top">
/// \copydoc fennec::any
/// \copydetails fennec::any
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::all "bool all(bvec x)"<br>
/// <td width="50%" style="vertical-align: top">
/// \copydoc fennec::all
/// \copydetails fennec::all
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::operator! "bool not(bvec x)"<br>
/// \ref fennec_vector_not "bool not(bvec x)"<br>
/// <td width="50%" style="vertical-align: top">
/// \copydoc fennec::operator!
/// \details
/// \returns the component-wise logical complement of \f$x\f$. <br>
/// \param x the boolean vector to inverse <br>
///
/// </table>
///
///
@ -199,13 +202,14 @@ constexpr genBType all(const vector<genBType, i...>& x)
{ return (x[i] && ...); }
///
/// \anchor fennec_vector_not
/// \brief Returns the component-wise logical complement of \f$x\f$.
///
/// \details
/// \returns the component-wise logical complement of \f$x\f$.
/// \param x the boolean vector to inverse
template<typename genBType = bool_t, size_t...i>
constexpr genBType operator!(const vector<genBType, i...>& x)
constexpr genBType operator not(const vector<genBType, i...>& x)
{ return vector<genBType, i...>((!x[i]) ...); }
}