- Removed Double Underscores for portability

This commit is contained in:
2025-07-26 21:13:32 -04:00
parent 7493b5252a
commit d02a51fd8d
51 changed files with 279 additions and 279 deletions

View File

@@ -68,7 +68,7 @@ add_library(fennec STATIC
include/fennec/containers/set.h include/fennec/containers/set.h
include/fennec/containers/tuple.h include/fennec/containers/tuple.h
include/fennec/containers/detail/__tuple.h include/fennec/containers/detail/_tuple.h
# LANG ================================================================================================================= # LANG =================================================================================================================
@@ -93,14 +93,14 @@ add_library(fennec STATIC
include/fennec/lang/utility.h include/fennec/lang/utility.h
include/fennec/lang/integer.h include/fennec/lang/integer.h
include/fennec/lang/detail/__bits.h include/fennec/lang/detail/_bits.h
include/fennec/lang/detail/__int.h include/fennec/lang/detail/_int.h
include/fennec/lang/detail/__numeric_transforms.h include/fennec/lang/detail/_numeric_transforms.h
include/fennec/lang/detail/__stdlib.h include/fennec/lang/detail/_stdlib.h
include/fennec/lang/detail/__type_traits.h include/fennec/lang/detail/_type_traits.h
include/fennec/lang/detail/__type_transforms.h include/fennec/lang/detail/_type_transforms.h
include/fennec/lang/detail/__type_sequences.h include/fennec/lang/detail/_type_sequences.h
include/fennec/lang/detail/__typeuuid.h include/fennec/lang/detail/_typeuuid.h
include/fennec/lang/assert.h source/lang/assert.cpp include/fennec/lang/assert.h source/lang/assert.cpp
@@ -115,7 +115,7 @@ add_library(fennec STATIC
include/fennec/memory/pointers.h include/fennec/memory/pointers.h
include/fennec/memory/ptr_traits.h include/fennec/memory/ptr_traits.h
include/fennec/memory/detail/__ptr_traits.h include/fennec/memory/detail/_ptr_traits.h
# DEBUG ================================================================================================================ # DEBUG ================================================================================================================
source/debug/assert_impl.cpp source/debug/assert_impl.cpp
@@ -150,11 +150,11 @@ add_library(fennec STATIC
include/fennec/math/ext/trigonometric.h include/fennec/math/ext/trigonometric.h
include/fennec/math/detail/__fwd.h include/fennec/math/detail/_fwd.h
include/fennec/math/detail/__math.h include/fennec/math/detail/_math.h
include/fennec/math/detail/__matrix.h include/fennec/math/detail/_matrix.h
include/fennec/math/detail/__types.h include/fennec/math/detail/_types.h
include/fennec/math/detail/__vector_traits.h include/fennec/math/detail/_vector_traits.h
# FPROC ================================================================================================================ # FPROC ================================================================================================================
@@ -163,7 +163,7 @@ add_library(fennec STATIC
include/fennec/fproc/strings/locale.h include/fennec/fproc/strings/locale.h
include/fennec/fproc/strings/string.h include/fennec/fproc/strings/string.h
include/fennec/fproc/strings/detail/__ctype.h include/fennec/fproc/strings/detail/_ctype.h
# Filesystem # Filesystem
include/fennec/fproc/filesystem/file.h source/fproc/filesystem/file.cpp include/fennec/fproc/filesystem/file.h source/fproc/filesystem/file.cpp

View File

@@ -113,18 +113,18 @@ struct array
/// ///
/// \brief /// \brief
friend constexpr bool_t operator==(const array& lhs, const array& rhs) { friend constexpr bool_t operator==(const array& lhs, const array& rhs) {
return array::__compare(lhs, rhs, make_index_sequence<ElemV>{}); return array::_compare(lhs, rhs, make_index_sequence<ElemV>{});
} }
friend constexpr bool_t operator!=(const array& lhs, const array& rhs) { friend constexpr bool_t operator!=(const array& lhs, const array& rhs) {
return not array::__compare(lhs, rhs, make_index_sequence<ElemV>{}); return not array::_compare(lhs, rhs, make_index_sequence<ElemV>{});
} }
/// @} /// @}
private: private:
template<size_t...i> template<size_t...i>
static bool __compare(const array& lhs, const array& rhs, index_sequence<i...>) { static bool _compare(const array& lhs, const array& rhs, index_sequence<i...>) {
return ((lhs[i] == rhs[i]) && ...); return ((lhs[i] == rhs[i]) && ...);
} }
}; };

View File

@@ -26,11 +26,11 @@ namespace fennec::detail
// leaves // leaves
template<size_t i, typename T> template<size_t i, typename T>
struct __tuple_leaf { struct _tuple_leaf {
T value; T value;
template<typename...ArgsT> template<typename...ArgsT>
__tuple_leaf(ArgsT&&...args) : value(args...) { _tuple_leaf(ArgsT&&...args) : value(args...) {
} }
constexpr operator T&() { constexpr operator T&() {
@@ -44,13 +44,13 @@ struct __tuple_leaf {
// proxy // proxy
template<typename, typename...TypesT> template<typename, typename...TypesT>
struct __tuple; struct _tuple;
template<size_t...i, typename...TypesT> template<size_t...i, typename...TypesT>
struct __tuple<index_sequence<i...>, TypesT...> : __tuple_leaf<i, TypesT>... { struct _tuple<index_sequence<i...>, TypesT...> : _tuple_leaf<i, TypesT>... {
template<typename...ArgsT> template<typename...ArgsT>
__tuple(ArgsT&&...args) : __tuple_leaf<i, TypesT>(args)... { _tuple(ArgsT&&...args) : _tuple_leaf<i, TypesT>(args)... {
} }
}; };

View File

@@ -19,7 +19,7 @@
#ifndef FENNEC_CONTAINERS_TUPLE_H #ifndef FENNEC_CONTAINERS_TUPLE_H
#define FENNEC_CONTAINERS_TUPLE_H #define FENNEC_CONTAINERS_TUPLE_H
#include <fennec/containers/detail/__tuple.h> #include <fennec/containers/detail/_tuple.h>
#include <fennec/lang/type_sequences.h> #include <fennec/lang/type_sequences.h>
namespace fennec namespace fennec
@@ -33,23 +33,23 @@ template<typename...TypesT> struct tuple;
template<size_t i, typename...TypesT> template<size_t i, typename...TypesT>
constexpr typename tuple<TypesT...>::template elem_t<i>& get(tuple<TypesT...>& x) { constexpr typename tuple<TypesT...>::template elem_t<i>& get(tuple<TypesT...>& x) {
using elem_t = typename tuple<TypesT...>::template elem_t<i>; using elem_t = typename tuple<TypesT...>::template elem_t<i>;
auto& it = static_cast<detail::__tuple_leaf<i, elem_t>>(x); auto& it = static_cast<detail::_tuple_leaf<i, elem_t>>(x);
return it; return it;
} }
template<size_t i, typename...TypesT> template<size_t i, typename...TypesT>
constexpr const typename tuple<TypesT...>::template elem_t<i>& get(tuple<TypesT...>& x) { constexpr const typename tuple<TypesT...>::template elem_t<i>& get(tuple<TypesT...>& x) {
using elem_t = typename tuple<TypesT...>::template elem_t<i>; using elem_t = typename tuple<TypesT...>::template elem_t<i>;
auto& it = static_cast<detail::__tuple_leaf<i, elem_t>>(x); auto& it = static_cast<detail::_tuple_leaf<i, elem_t>>(x);
return it; return it;
} }
template<typename...TypesT> template<typename...TypesT>
struct tuple : detail::__tuple<make_index_sequence<sizeof...(TypesT)>, TypesT...> { struct tuple : detail::_tuple<make_index_sequence<sizeof...(TypesT)>, TypesT...> {
public: public:
using base_t = detail::__tuple<make_index_sequence<sizeof...(TypesT)>, TypesT...>; using base_t = detail::_tuple<make_index_sequence<sizeof...(TypesT)>, TypesT...>;
template<size_t i> template<size_t i>
using elem_t = nth_element<i, TypesT...>; using elem_t = nth_element<i, TypesT...>;

View File

@@ -19,8 +19,8 @@
#ifndef FENNEC_FPROC_STRINGS_CSTRING_H #ifndef FENNEC_FPROC_STRINGS_CSTRING_H
#define FENNEC_FPROC_STRINGS_CSTRING_H #define FENNEC_FPROC_STRINGS_CSTRING_H
#include <fennec/fproc/strings/detail/__ctype.h> #include <fennec/fproc/strings/detail/_ctype.h>
#include <fennec/memory/detail/__string.h> #include <fennec/memory/detail/_string.h>
#include <fennec/lang/assert.h> #include <fennec/lang/assert.h>

View File

@@ -19,7 +19,7 @@
#ifndef FENNEC_FPROC_STRINGS_LOCALE_H #ifndef FENNEC_FPROC_STRINGS_LOCALE_H
#define FENNEC_FPROC_STRINGS_LOCALE_H #define FENNEC_FPROC_STRINGS_LOCALE_H
#include <fennec/fproc/strings/detail/__locale.h> #include <fennec/fproc/strings/detail/_locale.h>
namespace fennec namespace fennec
{ {

View File

@@ -19,7 +19,7 @@
#ifndef FENNEC_FPROC_STRINGS_STRING_H #ifndef FENNEC_FPROC_STRINGS_STRING_H
#define FENNEC_FPROC_STRINGS_STRING_H #define FENNEC_FPROC_STRINGS_STRING_H
#include <fennec/fproc/strings/detail/__ctype.h> #include <fennec/fproc/strings/detail/_ctype.h>
#include <fennec/fproc/strings/cstring.h> #include <fennec/fproc/strings/cstring.h>
#include <fennec/lang/assert.h> #include <fennec/lang/assert.h>

View File

@@ -19,8 +19,8 @@
#ifndef FENNEC_FPROC_STRINGS_wcstring_H #ifndef FENNEC_FPROC_STRINGS_wcstring_H
#define FENNEC_FPROC_STRINGS_wcstring_H #define FENNEC_FPROC_STRINGS_wcstring_H
#include <fennec/fproc/strings/detail/__ctype.h> #include <fennec/fproc/strings/detail/_ctype.h>
#include <fennec/memory/detail/__string.h> #include <fennec/memory/detail/_string.h>
#include <fennec/lang/assert.h> #include <fennec/lang/assert.h>

View File

@@ -19,7 +19,7 @@
#ifndef FENNEC_FPROC_wstringS_wstring_H #ifndef FENNEC_FPROC_wstringS_wstring_H
#define FENNEC_FPROC_wstringS_wstring_H #define FENNEC_FPROC_wstringS_wstring_H
#include <fennec/fproc/strings/detail/__ctype.h> #include <fennec/fproc/strings/detail/_ctype.h>
#include <fennec/fproc/strings/wcstring.h> #include <fennec/fproc/strings/wcstring.h>
#include <fennec/lang/assert.h> #include <fennec/lang/assert.h>

View File

@@ -70,17 +70,17 @@
using assert_handler = void (*)(const char *, const char *, int , const char *); using assert_handler = void (*)(const char *, const char *, int , const char *);
void __assert_impl(const char* expression, const char* file, int line, const char* function, const char* desc, bool halt); void _assert_impl(const char* expression, const char* file, int line, const char* function, const char* desc, bool halt);
// flagged unlikely to optimize branch prediction // flagged unlikely to optimize branch prediction
#define assert(expression, description) \ #define assert(expression, description) \
if(not(expression)) [[unlikely]] { \ if(not(expression)) [[unlikely]] { \
__assert_impl(#expression, __FILE__, __LINE__, __PRETTY_FUNCTION__, description, not FENNEC_RELEASE); \ _assert_impl(#expression, __FILE__, __LINE__, __PRETTY_FUNCTION__, description, not FENNEC_RELEASE); \
} }
#define assertf(expression, description) \ #define assertf(expression, description) \
if(not(expression)) [[unlikely]] { \ if(not(expression)) [[unlikely]] { \
__assert_impl(#expression, __FILE__, __LINE__, __PRETTY_FUNCTION__, description, true); \ _assert_impl(#expression, __FILE__, __LINE__, __PRETTY_FUNCTION__, description, true); \
} }
#if FENNEC_RELEASE #if FENNEC_RELEASE

View File

@@ -81,7 +81,7 @@
#include <fennec/lang/intrinsics.h> #include <fennec/lang/intrinsics.h>
#include <fennec/memory/common.h> #include <fennec/memory/common.h>
#include <fennec/lang/detail/__bits.h> #include <fennec/lang/detail/_bits.h>
namespace fennec namespace fennec
{ {
@@ -126,7 +126,7 @@ constexpr void* bit_and(void* arr, const void* mask, size_t n) {
const uint8_t* s = static_cast<const uint8_t*>(mask); const uint8_t* s = static_cast<const uint8_t*>(mask);
while (n > 0) { while (n > 0) {
const size_t step = detail::__bit_and(d, s, n); const size_t step = detail::_bit_and(d, s, n);
d += step; s += step; n -= step; d += step; s += step; n -= step;
} }
@@ -167,7 +167,7 @@ constexpr void* bit_or(void* arr, const void* mask, size_t n) {
const uint8_t* s = static_cast<const uint8_t*>(mask); const uint8_t* s = static_cast<const uint8_t*>(mask);
while (n > 0) while (n > 0)
{ {
const size_t step = detail::__bit_or(d, s, n); const size_t step = detail::_bit_or(d, s, n);
d += step; s += step; n -= step; d += step; s += step; n -= step;
} }
@@ -207,7 +207,7 @@ constexpr void* bit_xor(void* arr, const void* mask, size_t n) {
uint8_t* d = static_cast<uint8_t*>(arr); uint8_t* d = static_cast<uint8_t*>(arr);
const uint8_t* s = static_cast<const uint8_t*>(mask); const uint8_t* s = static_cast<const uint8_t*>(mask);
while (n > 0) { while (n > 0) {
const size_t step = detail::__bit_xor(d, s, n); const size_t step = detail::_bit_xor(d, s, n);
d += step; s += step; n -= step; d += step; s += step; n -= step;
} }

View File

@@ -1,59 +0,0 @@
// =====================================================================================================================
// fennec, a free and open source game engine
// Copyright © 2025 Medusa Slockbower
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================
#ifndef FENNEC_LANG_DETAIL_NUMERIC_TRANSFORMS_H
#define FENNEC_LANG_DETAIL_NUMERIC_TRANSFORMS_H
#include <fennec/lang/types.h>
#include <fennec/lang/type_transforms.h>
namespace fennec::detail
{
template<typename> struct __make_unsigned : type_identity<undefined_t> {};
template<> struct __make_unsigned<char_t> : type_identity<uchar_t> {};
template<> struct __make_unsigned<uchar_t> : type_identity<uchar_t> {};
template<> struct __make_unsigned<schar_t> : type_identity<uchar_t> {};
template<> struct __make_unsigned<short_t> : type_identity<ushort_t> {};
template<> struct __make_unsigned<ushort_t> : type_identity<ushort_t> {};
template<> struct __make_unsigned<uint_t> : type_identity<uint_t> {};
template<> struct __make_unsigned<int_t> : type_identity<uint_t> {};
template<> struct __make_unsigned<long_t> : type_identity<ulong_t> {};
template<> struct __make_unsigned<ulong_t> : type_identity<ulong_t> {};
template<> struct __make_unsigned<llong_t> : type_identity<ullong_t> {};
template<> struct __make_unsigned<ullong_t> : type_identity<ullong_t> {};
template<typename> struct __make_signed : type_identity<undefined_t> {};
template<> struct __make_signed<char_t> : type_identity<schar_t> {};
template<> struct __make_signed<uchar_t> : type_identity<schar_t> {};
template<> struct __make_signed<schar_t> : type_identity<schar_t> {};
template<> struct __make_signed<short_t> : type_identity<short_t> {};
template<> struct __make_signed<ushort_t> : type_identity<short_t> {};
template<> struct __make_signed<uint_t> : type_identity<int_t> {};
template<> struct __make_signed<int_t> : type_identity<int_t> {};
template<> struct __make_signed<long_t> : type_identity<long_t> {};
template<> struct __make_signed<ulong_t> : type_identity<long_t> {};
template<> struct __make_signed<llong_t> : type_identity<llong_t> {};
template<> struct __make_signed<ullong_t> : type_identity<llong_t> {};
}
#endif // FENNEC_LANG_DETAIL_NUMERIC_TRANSFORMS_H

View File

@@ -1,75 +0,0 @@
// =====================================================================================================================
// fennec, a free and open source game engine
// Copyright © 2025 Medusa Slockbower
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================
#ifndef FENNEC_LANG_DETAIL_TYPE_TRAITS_H
#define FENNEC_LANG_DETAIL_TYPE_TRAITS_H
#include <fennec/lang/constants.h>
#include <fennec/lang/float.h>
namespace fennec::detail
{
// Nothing interesting to note here
template<typename> struct __is_void : false_type {};
template<> struct __is_void<void> : true_type {};
template<typename> struct __is_bool : false_type {};
template<> struct __is_bool<bool_t> : true_type {};
template<typename> struct __is_null_pointer : false_type {};
template<> struct __is_null_pointer<nullptr_t> : true_type {};
// Provides definitions for all builtin int types
template<typename> struct __is_integral : false_type {};
template<> struct __is_integral<bool_t> : true_type {};
template<> struct __is_integral<char_t> : true_type {};
template<> struct __is_integral<char8_t> : true_type {};
template<> struct __is_integral<char16_t> : true_type {};
template<> struct __is_integral<char32_t> : true_type {};
template<> struct __is_integral<schar_t> : true_type {};
template<> struct __is_integral<uchar_t> : true_type {};
template<> struct __is_integral<wchar_t> : true_type {};
template<> struct __is_integral<short_t> : true_type {};
template<> struct __is_integral<ushort_t> : true_type {};
template<> struct __is_integral<int_t> : true_type {};
template<> struct __is_integral<uint_t> : true_type {};
template<> struct __is_integral<long_t> : true_type {};
template<> struct __is_integral<ulong_t> : true_type {};
template<> struct __is_integral<llong_t> : true_type {};
template<> struct __is_integral<ullong_t> : true_type {};
// Most unsigned types will underflow `-1` to the types maximum value
template<typename TypeT> struct __is_signed : bool_constant<TypeT(-1) < TypeT(0)> {};
template<typename TypeT> struct __is_unsigned : bool_constant<TypeT(-1) >= TypeT(0)> {};
template<typename> struct __is_floating_point : false_type {};
template<> struct __is_floating_point<float_t> : true_type {};
template<> struct __is_floating_point<double_t> : true_type {};
template<typename> struct __is_pointer : false_type {};
template<typename T> struct __is_pointer<T*> : true_type {};
template<typename T, typename U = T&&> U __declval(int);
template<typename T> T __declval(long);
template<typename T> struct __declval_protector : bool_constant<false> {};
}
#endif // FENNEC_LANG_DETAIL_TYPE_TRAITS_H

View File

@@ -25,112 +25,112 @@ namespace fennec::detail
{ {
// helper for bitwise and for 1 byte // helper for bitwise and for 1 byte
constexpr size_t __bit_and_8(void* dst, const void* src) { constexpr size_t _bit_and_8(void* dst, const void* src) {
*static_cast<uint8_t*>(dst) = *static_cast<uint8_t*>(dst) & *static_cast<const uint8_t*>(src); return 1; *static_cast<uint8_t*>(dst) = *static_cast<uint8_t*>(dst) & *static_cast<const uint8_t*>(src); return 1;
} }
// helper for bitwise and 2 bytes at once // helper for bitwise and 2 bytes at once
constexpr size_t __bit_and_16(void* dst, const void* src) { constexpr size_t _bit_and_16(void* dst, const void* src) {
*static_cast<uint16_t*>(dst) = *static_cast<uint16_t*>(dst) & *static_cast<const uint16_t*>(src); return 2; *static_cast<uint16_t*>(dst) = *static_cast<uint16_t*>(dst) & *static_cast<const uint16_t*>(src); return 2;
} }
// helper for bitwise and 4 bytes at once // helper for bitwise and 4 bytes at once
constexpr size_t __bit_and_32(void* dst, const void* src) { constexpr size_t _bit_and_32(void* dst, const void* src) {
*static_cast<uint32_t*>(dst) = *static_cast<uint32_t*>(dst) & *static_cast<const uint32_t*>(src); return 4; *static_cast<uint32_t*>(dst) = *static_cast<uint32_t*>(dst) & *static_cast<const uint32_t*>(src); return 4;
} }
// helper for bitwise and 8 bytes at once // helper for bitwise and 8 bytes at once
constexpr size_t __bit_and_64(void* dst, const void* src) { constexpr size_t _bit_and_64(void* dst, const void* src) {
*static_cast<uint64_t*>(dst) = *static_cast<uint64_t*>(dst) & *static_cast<const uint64_t*>(src); return 8; *static_cast<uint64_t*>(dst) = *static_cast<uint64_t*>(dst) & *static_cast<const uint64_t*>(src); return 8;
} }
// helper for selecting size // helper for selecting size
constexpr size_t __bit_and(void* dst, const void* src, size_t n) { constexpr size_t _bit_and(void* dst, const void* src, size_t n) {
switch (n) { switch (n) {
case 0: case 0:
return 0; return 0;
case 1: case 1:
return __bit_and_8(dst, src); return _bit_and_8(dst, src);
case 2: case 3: case 2: case 3:
return __bit_and_16(dst, src); return _bit_and_16(dst, src);
case 4: case 5: case 6: case 7: case 4: case 5: case 6: case 7:
return __bit_and_32(dst, src); return _bit_and_32(dst, src);
default: default:
return __bit_and_64(dst, src); return _bit_and_64(dst, src);
} }
} }
// helper for bitwise or for 1 byte // helper for bitwise or for 1 byte
constexpr size_t __bit_or_8(void* dst, const void* src) { constexpr size_t _bit_or_8(void* dst, const void* src) {
*static_cast<uint8_t*>(dst) = *static_cast<uint8_t*>(dst) | *static_cast<const uint8_t*>(src); return 1; *static_cast<uint8_t*>(dst) = *static_cast<uint8_t*>(dst) | *static_cast<const uint8_t*>(src); return 1;
} }
// helper for bitwise or 2 bytes at once // helper for bitwise or 2 bytes at once
constexpr size_t __bit_or_16(void* dst, const void* src) { constexpr size_t _bit_or_16(void* dst, const void* src) {
*static_cast<uint16_t*>(dst) = *static_cast<uint16_t*>(dst) | *static_cast<const uint16_t*>(src); return 2; *static_cast<uint16_t*>(dst) = *static_cast<uint16_t*>(dst) | *static_cast<const uint16_t*>(src); return 2;
} }
// helper for bitwise or 4 bytes at once // helper for bitwise or 4 bytes at once
constexpr size_t __bit_or_32(void* dst, const void* src) { constexpr size_t _bit_or_32(void* dst, const void* src) {
*static_cast<uint32_t*>(dst) = *static_cast<uint32_t*>(dst) | *static_cast<const uint32_t*>(src); return 4; *static_cast<uint32_t*>(dst) = *static_cast<uint32_t*>(dst) | *static_cast<const uint32_t*>(src); return 4;
} }
// helper for bitwise or 8 bytes at once // helper for bitwise or 8 bytes at once
constexpr size_t __bit_or_64(void* dst, const void* src) { constexpr size_t _bit_or_64(void* dst, const void* src) {
*static_cast<uint64_t*>(dst) = *static_cast<uint64_t*>(dst) | *static_cast<const uint64_t*>(src); return 8; *static_cast<uint64_t*>(dst) = *static_cast<uint64_t*>(dst) | *static_cast<const uint64_t*>(src); return 8;
} }
// helper for selecting size // helper for selecting size
constexpr size_t __bit_or(void* dst, const void* src, size_t n) { constexpr size_t _bit_or(void* dst, const void* src, size_t n) {
switch (n) { switch (n) {
case 0: case 0:
return 0; return 0;
case 1: case 1:
return __bit_or_8(dst, src); return _bit_or_8(dst, src);
case 2: case 3: case 2: case 3:
return __bit_or_16(dst, src); return _bit_or_16(dst, src);
case 4: case 5: case 6: case 7: case 4: case 5: case 6: case 7:
return __bit_or_32(dst, src); return _bit_or_32(dst, src);
default: default:
return __bit_or_64(dst, src); return _bit_or_64(dst, src);
} }
} }
// helper for bitwise and 1 byte // helper for bitwise and 1 byte
constexpr size_t __bit_xor_8(void* dst, const void* src) { constexpr size_t _bit_xor_8(void* dst, const void* src) {
*static_cast<uint8_t*>(dst) = *static_cast<uint8_t*>(dst) ^ *static_cast<const uint8_t*>(src); return 1; *static_cast<uint8_t*>(dst) = *static_cast<uint8_t*>(dst) ^ *static_cast<const uint8_t*>(src); return 1;
} }
// helper for bitwise xor 2 bytes at once // helper for bitwise xor 2 bytes at once
constexpr size_t __bit_xor_16(void* dst, const void* src) { constexpr size_t _bit_xor_16(void* dst, const void* src) {
*static_cast<uint16_t*>(dst) = *static_cast<uint16_t*>(dst) ^ *static_cast<const uint16_t*>(src); return 2; *static_cast<uint16_t*>(dst) = *static_cast<uint16_t*>(dst) ^ *static_cast<const uint16_t*>(src); return 2;
} }
// helper for bitwise xor 4 bytes at once // helper for bitwise xor 4 bytes at once
constexpr size_t __bit_xor_32(void* dst, const void* src) { constexpr size_t _bit_xor_32(void* dst, const void* src) {
*static_cast<uint32_t*>(dst) = *static_cast<uint32_t*>(dst) ^ *static_cast<const uint32_t*>(src); return 4; *static_cast<uint32_t*>(dst) = *static_cast<uint32_t*>(dst) ^ *static_cast<const uint32_t*>(src); return 4;
} }
// helper for bitwise xor 8 bytes at once // helper for bitwise xor 8 bytes at once
constexpr size_t __bit_xor_64(void* dst, const void* src) { constexpr size_t _bit_xor_64(void* dst, const void* src) {
*static_cast<uint64_t*>(dst) = *static_cast<uint64_t*>(dst) ^ *static_cast<const uint64_t*>(src); return 8; *static_cast<uint64_t*>(dst) = *static_cast<uint64_t*>(dst) ^ *static_cast<const uint64_t*>(src); return 8;
} }
// helper for selecting size // helper for selecting size
constexpr size_t __bit_xor(void* dst, const void* src, size_t n) { constexpr size_t _bit_xor(void* dst, const void* src, size_t n) {
switch (n) { switch (n) {
case 0: case 0:
return 0; return 0;
case 1: case 1:
return __bit_xor_8(dst, src); return _bit_xor_8(dst, src);
case 2: case 3: case 2: case 3:
return __bit_xor_16(dst, src); return _bit_xor_16(dst, src);
case 4: case 5: case 6: case 7: case 4: case 5: case 6: case 7:
return __bit_xor_32(dst, src); return _bit_xor_32(dst, src);
default: default:
return __bit_xor_64(dst, src); return _bit_xor_64(dst, src);
} }
} }

View File

@@ -0,0 +1,59 @@
// =====================================================================================================================
// fennec, a free and open source game engine
// Copyright © 2025 Medusa Slockbower
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================
#ifndef FENNEC_LANG_DETAIL_NUMERIC_TRANSFORMS_H
#define FENNEC_LANG_DETAIL_NUMERIC_TRANSFORMS_H
#include <fennec/lang/types.h>
#include <fennec/lang/type_transforms.h>
namespace fennec::detail
{
template<typename> struct _make_unsigned : type_identity<undefined_t> {};
template<> struct _make_unsigned<char_t> : type_identity<uchar_t> {};
template<> struct _make_unsigned<uchar_t> : type_identity<uchar_t> {};
template<> struct _make_unsigned<schar_t> : type_identity<uchar_t> {};
template<> struct _make_unsigned<short_t> : type_identity<ushort_t> {};
template<> struct _make_unsigned<ushort_t> : type_identity<ushort_t> {};
template<> struct _make_unsigned<uint_t> : type_identity<uint_t> {};
template<> struct _make_unsigned<int_t> : type_identity<uint_t> {};
template<> struct _make_unsigned<long_t> : type_identity<ulong_t> {};
template<> struct _make_unsigned<ulong_t> : type_identity<ulong_t> {};
template<> struct _make_unsigned<llong_t> : type_identity<ullong_t> {};
template<> struct _make_unsigned<ullong_t> : type_identity<ullong_t> {};
template<typename> struct _make_signed : type_identity<undefined_t> {};
template<> struct _make_signed<char_t> : type_identity<schar_t> {};
template<> struct _make_signed<uchar_t> : type_identity<schar_t> {};
template<> struct _make_signed<schar_t> : type_identity<schar_t> {};
template<> struct _make_signed<short_t> : type_identity<short_t> {};
template<> struct _make_signed<ushort_t> : type_identity<short_t> {};
template<> struct _make_signed<uint_t> : type_identity<int_t> {};
template<> struct _make_signed<int_t> : type_identity<int_t> {};
template<> struct _make_signed<long_t> : type_identity<long_t> {};
template<> struct _make_signed<ulong_t> : type_identity<long_t> {};
template<> struct _make_signed<llong_t> : type_identity<llong_t> {};
template<> struct _make_signed<ullong_t> : type_identity<llong_t> {};
}
#endif // FENNEC_LANG_DETAIL_NUMERIC_TRANSFORMS_H

View File

@@ -24,16 +24,16 @@
namespace fennec::detail namespace fennec::detail
{ {
template<typename FirstT, typename... RestT> struct __first_element : type_identity<FirstT> {}; template<typename FirstT, typename... RestT> struct _first_element : type_identity<FirstT> {};
template<size_t n, size_t i, typename...TypesT> struct __nth_element; template<size_t n, size_t i, typename...TypesT> struct _nth_element;
template<size_t n, size_t i> struct __nth_element<n, i> : type_identity<void> {}; template<size_t n, size_t i> struct _nth_element<n, i> : type_identity<void> {};
template<size_t n, size_t i, typename HeadT, typename...RestT> template<size_t n, size_t i, typename HeadT, typename...RestT>
struct __nth_element<n, i, HeadT, RestT...> : conditional< struct _nth_element<n, i, HeadT, RestT...> : conditional<
n == i, type_identity<HeadT>, n == i, type_identity<HeadT>,
__nth_element<n, i + 1, RestT...> _nth_element<n, i + 1, RestT...>
> {}; > {};
} }

View File

@@ -0,0 +1,75 @@
// =====================================================================================================================
// fennec, a free and open source game engine
// Copyright © 2025 Medusa Slockbower
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================
#ifndef FENNEC_LANG_DETAIL_TYPE_TRAITS_H
#define FENNEC_LANG_DETAIL_TYPE_TRAITS_H
#include <fennec/lang/constants.h>
#include <fennec/lang/float.h>
namespace fennec::detail
{
// Nothing interesting to note here
template<typename> struct _is_void : false_type {};
template<> struct _is_void<void> : true_type {};
template<typename> struct _is_bool : false_type {};
template<> struct _is_bool<bool_t> : true_type {};
template<typename> struct _is_null_pointer : false_type {};
template<> struct _is_null_pointer<nullptr_t> : true_type {};
// Provides definitions for all builtin int types
template<typename> struct _is_integral : false_type {};
template<> struct _is_integral<bool_t> : true_type {};
template<> struct _is_integral<char_t> : true_type {};
template<> struct _is_integral<char8_t> : true_type {};
template<> struct _is_integral<char16_t> : true_type {};
template<> struct _is_integral<char32_t> : true_type {};
template<> struct _is_integral<schar_t> : true_type {};
template<> struct _is_integral<uchar_t> : true_type {};
template<> struct _is_integral<wchar_t> : true_type {};
template<> struct _is_integral<short_t> : true_type {};
template<> struct _is_integral<ushort_t> : true_type {};
template<> struct _is_integral<int_t> : true_type {};
template<> struct _is_integral<uint_t> : true_type {};
template<> struct _is_integral<long_t> : true_type {};
template<> struct _is_integral<ulong_t> : true_type {};
template<> struct _is_integral<llong_t> : true_type {};
template<> struct _is_integral<ullong_t> : true_type {};
// Most unsigned types will underflow `-1` to the types maximum value
template<typename TypeT> struct _is_signed : bool_constant<TypeT(-1) < TypeT(0)> {};
template<typename TypeT> struct _is_unsigned : bool_constant<TypeT(-1) >= TypeT(0)> {};
template<typename> struct _is_floating_point : false_type {};
template<> struct _is_floating_point<float_t> : true_type {};
template<> struct _is_floating_point<double_t> : true_type {};
template<typename> struct _is_pointer : false_type {};
template<typename T> struct _is_pointer<T*> : true_type {};
template<typename T, typename U = T&&> U _declval(int);
template<typename T> T _declval(long);
template<typename T> struct _declval_protector : bool_constant<false> {};
}
#endif // FENNEC_LANG_DETAIL_TYPE_TRAITS_H

View File

@@ -25,23 +25,23 @@ namespace fennec::detail
{ {
template<typename _Tp, typename = void> template<typename _Tp, typename = void>
struct __add_lvalue_reference { struct _add_lvalue_reference {
using type = _Tp; using type = _Tp;
}; };
template<typename _Tp> template<typename _Tp>
struct __add_lvalue_reference<_Tp, void_t<_Tp&>> { struct _add_lvalue_reference<_Tp, void_t<_Tp&>> {
using type = _Tp&; using type = _Tp&;
}; };
template<typename _Tp, typename = void> template<typename _Tp, typename = void>
struct __add_rvalue_reference { struct _add_rvalue_reference {
using type = _Tp; using type = _Tp;
}; };
template<typename _Tp> template<typename _Tp>
struct __add_rvalue_reference<_Tp, void_t<_Tp&&>> { struct _add_rvalue_reference<_Tp, void_t<_Tp&&>> {
using type = _Tp&&; using type = _Tp&&;
}; };

View File

@@ -25,7 +25,7 @@ namespace fennec::detail
{ {
template<typename RootT> template<typename RootT>
FENNEC_NO_INLINE uint64_t __typeuuid() { FENNEC_NO_INLINE uint64_t _typeuuid() {
static uint64_t i = 0; static uint64_t i = 0;
return ++i; return ++i;
} }

View File

@@ -55,7 +55,7 @@
/// </table> /// </table>
#include <fennec/lang/type_transforms.h> #include <fennec/lang/type_transforms.h>
#include <fennec/lang/detail/__numeric_transforms.h> #include <fennec/lang/detail/_numeric_transforms.h>
namespace fennec namespace fennec
{ {
@@ -63,7 +63,7 @@ namespace fennec
/// ///
/// \brief Get the corresponding signed integral type of TypeT /// \brief Get the corresponding signed integral type of TypeT
/// \tparam TypeT the integral type to transform /// \tparam TypeT the integral type to transform
template<typename TypeT> struct make_signed : detail::__make_signed<remove_cv_t<TypeT>> {}; template<typename TypeT> struct make_signed : detail::_make_signed<remove_cv_t<TypeT>> {};
/// ///
/// \brief Shorthand for `typename make_signed<TypeT>::type` /// \brief Shorthand for `typename make_signed<TypeT>::type`
@@ -73,7 +73,7 @@ template<typename TypeT> using make_signed_t = typename make_signed<TypeT>::type
/// ///
/// \brief Get the corresponding unsigned integral type of TypeT /// \brief Get the corresponding unsigned integral type of TypeT
/// \tparam TypeT the integral type to transform /// \tparam TypeT the integral type to transform
template<typename TypeT> struct make_unsigned : detail::__make_unsigned<remove_cv_t<TypeT>> {}; template<typename TypeT> struct make_unsigned : detail::_make_unsigned<remove_cv_t<TypeT>> {};
/// ///
/// \brief Shorthand for `typename make_unsigned<TypeT>::type` /// \brief Shorthand for `typename make_unsigned<TypeT>::type`

View File

@@ -54,7 +54,7 @@
/// </table> /// </table>
/// ///
#include <fennec/lang/detail/__type_sequences.h> #include <fennec/lang/detail/_type_sequences.h>
namespace fennec namespace fennec
{ {
@@ -62,14 +62,14 @@ namespace fennec
/// ///
/// \brief Get the first element of a template parameter pack /// \brief Get the first element of a template parameter pack
/// \tparam TypesT the Parameter Pack /// \tparam TypesT the Parameter Pack
template<typename...TypesT> struct first_element : detail::__first_element<TypesT...> {}; template<typename...TypesT> struct first_element : detail::_first_element<TypesT...> {};
/// ///
/// \brief alias for first_element<TypesT>::type /// \brief alias for first_element<TypesT>::type
template<typename...TypesT> using first_element_t = typename first_element<TypesT...>::type; template<typename...TypesT> using first_element_t = typename first_element<TypesT...>::type;
template<size_t n, typename...TypesT> struct nth_element : detail::__nth_element<n, 0, TypesT...> {}; template<size_t n, typename...TypesT> struct nth_element : detail::_nth_element<n, 0, TypesT...> {};
/// ///

View File

@@ -107,16 +107,16 @@
/// ///
#include <fennec/lang/type_transforms.h> #include <fennec/lang/type_transforms.h>
#include <fennec/lang/detail/__type_traits.h> #include <fennec/lang/detail/_type_traits.h>
namespace fennec namespace fennec
{ {
// fennec::declval ===================================================================================================== // fennec::declval =====================================================================================================
template<typename T> auto declval() noexcept -> decltype(detail::__declval<T>(0)) { template<typename T> auto declval() noexcept -> decltype(detail::_declval<T>(0)) {
static_assert(detail::__declval_protector<T>{}, "declval must not be used"); static_assert(detail::_declval_protector<T>{}, "declval must not be used");
return detail::__declval<T>(0); return detail::_declval<T>(0);
} }
constexpr inline bool is_constant_evaluated() noexcept { constexpr inline bool is_constant_evaluated() noexcept {
@@ -136,7 +136,7 @@ constexpr inline bool is_constant_evaluated() noexcept {
/// \details Stores a boolean value in `is_void::value`, representing whether the provided type is of base type void. /// \details Stores a boolean value in `is_void::value`, representing whether the provided type is of base type void.
/// \tparam T type to check /// \tparam T type to check
template<typename T> struct is_void template<typename T> struct is_void
: detail::__is_void<remove_cvr_t<T>>{}; : detail::_is_void<remove_cvr_t<T>>{};
/// ///
/// \brief shorthand for ```is_void<T>::value``` /// \brief shorthand for ```is_void<T>::value```
@@ -153,7 +153,7 @@ template<typename T> constexpr bool_t is_void_v = is_void<T>::value;
/// \details Stores a boolean value in `is_bool::value`, representing whether the provided type is of base type bool. /// \details Stores a boolean value in `is_bool::value`, representing whether the provided type is of base type bool.
/// \tparam T type to check /// \tparam T type to check
template<typename T> struct is_bool template<typename T> struct is_bool
: detail::__is_bool<remove_cvr_t<T>>{}; : detail::_is_bool<remove_cvr_t<T>>{};
/// ///
/// \brief shorthand for ```is_bool<T>::value``` /// \brief shorthand for ```is_bool<T>::value```
@@ -170,7 +170,7 @@ template<typename T> constexpr bool_t is_bool_v = is_bool<T>::value;
/// \details Stores a boolean value in `is_null_pointer::value`, representing whether the provided type is of base type nullptr_t. /// \details Stores a boolean value in `is_null_pointer::value`, representing whether the provided type is of base type nullptr_t.
/// \tparam T type to check /// \tparam T type to check
template<typename T> struct is_null_pointer template<typename T> struct is_null_pointer
: detail::__is_null_pointer<remove_cvr_t<T>>{}; : detail::_is_null_pointer<remove_cvr_t<T>>{};
/// ///
/// \brief shorthand for ```is_null_pointer<T>::value``` /// \brief shorthand for ```is_null_pointer<T>::value```
@@ -235,7 +235,7 @@ template<typename T> constexpr size_t is_class_v = is_class<T>::value;
/// \details Stores a boolean value in `is_integral::value`, representing whether the provided type is of a base integer type. /// \details Stores a boolean value in `is_integral::value`, representing whether the provided type is of a base integer type.
/// \tparam T type to check /// \tparam T type to check
template<typename T> struct is_integral template<typename T> struct is_integral
: detail::__is_integral<remove_cvr_t<T>> {}; : detail::_is_integral<remove_cvr_t<T>> {};
/// ///
/// \brief shorthand for ```is_integral<T>::value``` /// \brief shorthand for ```is_integral<T>::value```
@@ -249,7 +249,7 @@ template<typename T> constexpr bool_t is_integral_v = is_integral<T>::value;
/// \details Checks if type `T` is a signed type i.e. `T(-1) < T(0)` and stores it in `is_same::value`. /// \details Checks if type `T` is a signed type i.e. `T(-1) < T(0)` and stores it in `is_same::value`.
/// \tparam T type to check /// \tparam T type to check
template<typename T> struct is_signed template<typename T> struct is_signed
: detail::__is_signed<remove_cvr_t<T>> {}; : detail::_is_signed<remove_cvr_t<T>> {};
/// ///
/// \brief shorthand for ```is_signed<T>::value``` /// \brief shorthand for ```is_signed<T>::value```
@@ -263,7 +263,7 @@ template<typename T> constexpr bool_t is_signed_v = is_signed<T>::value;
/// \details Checks if type `T` is an unsigned type i.e. `T(-1) > T(0)` and stores it in `is_same::value`. /// \details Checks if type `T` is an unsigned type i.e. `T(-1) > T(0)` and stores it in `is_same::value`.
/// \tparam T type to check /// \tparam T type to check
template<typename T> struct is_unsigned template<typename T> struct is_unsigned
: detail::__is_unsigned<remove_cvr_t<T>> {}; : detail::_is_unsigned<remove_cvr_t<T>> {};
/// ///
/// \brief shorthand for ```is_unsigned<T>::value``` /// \brief shorthand for ```is_unsigned<T>::value```
@@ -280,7 +280,7 @@ template<typename T> constexpr bool_t is_unsigned_v = is_unsigned<T>::value;
/// \details Checks if type `T` is a floating point type and store it in `is_same::value`. /// \details Checks if type `T` is a floating point type and store it in `is_same::value`.
/// \tparam T type to check /// \tparam T type to check
template<typename T> struct is_floating_point template<typename T> struct is_floating_point
: detail::__is_floating_point<remove_cvr_t<T>>{}; : detail::_is_floating_point<remove_cvr_t<T>>{};
/// ///
/// \brief shorthand for ```is_floating_point<T>::value``` /// \brief shorthand for ```is_floating_point<T>::value```
@@ -296,7 +296,7 @@ template<typename T> constexpr bool_t is_floating_point_v = is_floating_point<T>
/// \details Checks if type `T` is a floating point type and store it in `is_same::value`. /// \details Checks if type `T` is a floating point type and store it in `is_same::value`.
/// \tparam T type to check /// \tparam T type to check
template<typename T> struct is_pointer template<typename T> struct is_pointer
: detail::__is_pointer<remove_cvr_t<T>>{}; : detail::_is_pointer<remove_cvr_t<T>>{};
/// ///
/// \brief shorthand for ```is_floating_point<T>::value``` /// \brief shorthand for ```is_floating_point<T>::value```

View File

@@ -32,7 +32,7 @@
#define FENNEC_LANG_TYPE_TRANSFORMS_H #define FENNEC_LANG_TYPE_TRANSFORMS_H
#include <fennec/lang/type_identity.h> #include <fennec/lang/type_identity.h>
#include <fennec/lang/detail/__type_transforms.h> #include <fennec/lang/detail/_type_transforms.h>
/// ///
/// \page fennec_lang_type_transforms Type Transforms /// \page fennec_lang_type_transforms Type Transforms
@@ -192,7 +192,7 @@ template<typename T> using remove_reference_t = typename remove_reference<T>::t
/// ///
/// \details adds a lvalue reference to the provided type such that 'T' becomes 'T&' /// \details adds a lvalue reference to the provided type such that 'T' becomes 'T&'
/// \tparam T Reference Type /// \tparam T Reference Type
template<typename T> struct add_lvalue_reference : detail::__add_lvalue_reference<T> {}; template<typename T> struct add_lvalue_reference : detail::_add_lvalue_reference<T> {};
/// ///
/// \brief shorthand for `typename remove_reference<T>::type` /// \brief shorthand for `typename remove_reference<T>::type`
@@ -204,7 +204,7 @@ template<typename T> using add_lvalue_reference_t = typename add_lvalue_referen
/// ///
/// \details adds a rvalue reference to the provided type such that 'T' becomes 'T&&' /// \details adds a rvalue reference to the provided type such that 'T' becomes 'T&&'
/// \tparam T Reference Type /// \tparam T Reference Type
template<typename T> struct add_rvalue_reference : detail::__add_rvalue_reference<T> {}; template<typename T> struct add_rvalue_reference : detail::_add_rvalue_reference<T> {};
/// ///
/// \brief shorthand for `typename remove_reference<T>::type` /// \brief shorthand for `typename remove_reference<T>::type`

View File

@@ -201,7 +201,7 @@
/// ///
/// ///
#include <fennec/lang/detail/__int.h> #include <fennec/lang/detail/_int.h>
#include <fennec/lang/conditional_types.h> #include <fennec/lang/conditional_types.h>

View File

@@ -23,7 +23,7 @@
#include <fennec/lang/types.h> #include <fennec/lang/types.h>
#include <fennec/lang/type_traits.h> #include <fennec/lang/type_traits.h>
#include <fennec/lang/detail/__typeuuid.h> #include <fennec/lang/detail/_typeuuid.h>
namespace fennec namespace fennec
{ {
@@ -39,7 +39,7 @@ FENNEC_NO_INLINE uint64_t typeuuid() {
if (init) return id; if (init) return id;
init = true; init = true;
return id = detail::__typeuuid<RootT>(); return id = detail::_typeuuid<RootT>();
} }
} }

View File

@@ -269,7 +269,7 @@
/// ///
/// ///
#include <fennec/math/detail/__math.h> #include <fennec/math/detail/_math.h>
#include <fennec/lang/limits.h> #include <fennec/lang/limits.h>

View File

@@ -19,7 +19,7 @@
#ifndef FENNEC_MATH_DETAIL_FWD_H #ifndef FENNEC_MATH_DETAIL_FWD_H
#define FENNEC_MATH_DETAIL_FWD_H #define FENNEC_MATH_DETAIL_FWD_H
#include <fennec/math/detail/__types.h> #include <fennec/math/detail/_types.h>
namespace fennec namespace fennec
{ {
@@ -29,10 +29,10 @@ template<typename ScalarT, size_t RowsV, size_t...ColIndicesV> struct matrix; //
// Simplified interface for creating sized vectors or matrices // Simplified interface for creating sized vectors or matrices
template<typename ScalarT, size_t SizeV> using vec template<typename ScalarT, size_t SizeV> using vec
= decltype(detail::__gen_vector<vector, ScalarT>(make_index_sequence<SizeV>{})); // Gets the type returned by this function = decltype(detail::_gen_vector<vector, ScalarT>(make_index_sequence<SizeV>{})); // Gets the type returned by this function
template<typename ScalarT, size_t ColsV, size_t RowsV> using mat template<typename ScalarT, size_t ColsV, size_t RowsV> using mat
= decltype(detail::__gen_matrix<matrix, ScalarT, RowsV>(make_index_sequence<ColsV>{})); // Gets the type returned by this function = decltype(detail::_gen_matrix<matrix, ScalarT, RowsV>(make_index_sequence<ColsV>{})); // Gets the type returned by this function
} }

View File

@@ -19,7 +19,7 @@
#ifndef FENNEC_MATH_DETAIL_MATRIX_H #ifndef FENNEC_MATH_DETAIL_MATRIX_H
#define FENNEC_MATH_DETAIL_MATRIX_H #define FENNEC_MATH_DETAIL_MATRIX_H
#include <fennec/math/detail/__fwd.h> #include <fennec/math/detail/_fwd.h>
namespace fennec namespace fennec
{ {

View File

@@ -28,11 +28,11 @@ namespace detail
{ {
template<template<typename, size_t...> typename VectorT, typename ScalarT, size_t...IndicesV> template<template<typename, size_t...> typename VectorT, typename ScalarT, size_t...IndicesV>
VectorT<ScalarT, IndicesV...> __gen_vector(index_sequence<IndicesV...>); // Helper for substituting a size N with sequence of integers VectorT<ScalarT, IndicesV...> _gen_vector(index_sequence<IndicesV...>); // Helper for substituting a size N with sequence of integers
template<template<typename, size_t...> typename MatrixT, typename ScalarT, size_t RowsV, size_t...IndicesV> template<template<typename, size_t...> typename MatrixT, typename ScalarT, size_t RowsV, size_t...IndicesV>
MatrixT<ScalarT, RowsV, IndicesV...> __gen_matrix(index_sequence<IndicesV...>); // Helper for substituting a size Columns with sequence of integers MatrixT<ScalarT, RowsV, IndicesV...> _gen_matrix(index_sequence<IndicesV...>); // Helper for substituting a size Columns with sequence of integers
} }

View File

@@ -19,7 +19,7 @@
#ifndef FENNEC_MATH_DETAIL_VECTOR_TRAITS_H #ifndef FENNEC_MATH_DETAIL_VECTOR_TRAITS_H
#define FENNEC_MATH_DETAIL_VECTOR_TRAITS_H #define FENNEC_MATH_DETAIL_VECTOR_TRAITS_H
#include <fennec/math/detail/__fwd.h> #include <fennec/math/detail/_fwd.h>
#include <fennec/lang/type_traits.h> #include <fennec/lang/type_traits.h>
#include <fennec/math/swizzle.h> #include <fennec/math/swizzle.h>

View File

@@ -87,7 +87,7 @@
/// ///
/// ///
#include <fennec/math/detail/__math.h> #include <fennec/math/detail/_math.h>
#include <fennec/math/vector.h> #include <fennec/math/vector.h>
namespace fennec namespace fennec

View File

@@ -43,8 +43,8 @@
/// ///
/// ///
#include <fennec/math/detail/__fwd.h> #include <fennec/math/detail/_fwd.h>
#include <fennec/math/detail/__matrix.h> #include <fennec/math/detail/_matrix.h>
#include <fennec/containers/array.h> #include <fennec/containers/array.h>

View File

@@ -59,8 +59,8 @@
#include <fennec/lang/types.h> #include <fennec/lang/types.h>
#include <fennec/math/detail/__fwd.h> #include <fennec/math/detail/_fwd.h>
#include <fennec/math/detail/__types.h> #include <fennec/math/detail/_types.h>
namespace fennec namespace fennec
{ {

View File

@@ -144,7 +144,7 @@
/// ///
/// ///
#include <fennec/math/detail/__math.h> #include <fennec/math/detail/_math.h>
namespace fennec namespace fennec
{ {

View File

@@ -103,7 +103,7 @@
/// ///
/// ///
#include <fennec/math/detail/__fwd.h> #include <fennec/math/detail/_fwd.h>
#include <fennec/math/vector_base.h> #include <fennec/math/vector_base.h>
#include <fennec/math/vector_traits.h> #include <fennec/math/vector_traits.h>
@@ -120,7 +120,7 @@ namespace fennec
/// \tparam ScalarT The type of the Components /// \tparam ScalarT The type of the Components
/// \tparam SizeV The number of Components /// \tparam SizeV The number of Components
template<typename ScalarT, size_t SizeV> template<typename ScalarT, size_t SizeV>
using vec = decltype(detail::__gen_vector<vector, ScalarT>(make_index_sequence<SizeV>{})); using vec = decltype(detail::_gen_vector<vector, ScalarT>(make_index_sequence<SizeV>{}));
/// ///

View File

@@ -20,7 +20,7 @@
#ifndef FENNEC_MATH_VECTOR_BASE_H #ifndef FENNEC_MATH_VECTOR_BASE_H
#define FENNEC_MATH_VECTOR_BASE_H #define FENNEC_MATH_VECTOR_BASE_H
#include <fennec/math/detail/__fwd.h> #include <fennec/math/detail/_fwd.h>
#include <fennec/math/swizzle.h> #include <fennec/math/swizzle.h>
#include <fennec/math/vector_storage.h> #include <fennec/math/vector_storage.h>

View File

@@ -63,7 +63,7 @@
/// </table> /// </table>
/// ///
#include <fennec/math/detail/__vector_traits.h> #include <fennec/math/detail/_vector_traits.h>
namespace fennec namespace fennec
{ {

View File

@@ -33,7 +33,7 @@
#define FENNEC_MEMORY_H #define FENNEC_MEMORY_H
#include <fennec/lang/type_traits.h> #include <fennec/lang/type_traits.h>
#include <fennec/memory/detail/__string.h> #include <fennec/memory/detail/_string.h>
namespace fennec namespace fennec
{ {

View File

@@ -32,15 +32,15 @@ namespace detail
// helper to get the element type of the pointer class // helper to get the element type of the pointer class
template<typename ClassT, typename = void> template<typename ClassT, typename = void>
struct __ptr_get_element : first_element<ClassT> { }; // Default case, return the first template parameter struct _ptr_get_element : first_element<ClassT> { }; // Default case, return the first template parameter
// overload for types that have a member `ClassT::element_t` // overload for types that have a member `ClassT::element_t`
template<typename ClassT> requires requires { typename ClassT::element_t; } template<typename ClassT> requires requires { typename ClassT::element_t; }
struct __ptr_get_element<ClassT, ClassT> { using type = typename ClassT::element_t; }; struct _ptr_get_element<ClassT, ClassT> { using type = typename ClassT::element_t; };
// helper for generating `pointer_to` // helper for generating `pointer_to`
template<typename PtrT, typename ElemT, bool_t = is_void_v<ElemT>> template<typename PtrT, typename ElemT, bool_t = is_void_v<ElemT>>
struct __ptr_traits_ptr_to struct _ptr_traits_ptr_to
{ {
using pointer_t = PtrT; using pointer_t = PtrT;
using element_t = ElemT; using element_t = ElemT;
@@ -52,7 +52,7 @@ struct __ptr_traits_ptr_to
// overload for C style pointers // overload for C style pointers
template<typename ElemT> template<typename ElemT>
struct __ptr_traits_ptr_to<ElemT*, ElemT, false> struct _ptr_traits_ptr_to<ElemT*, ElemT, false>
{ {
using pointer_t = ElemT*; using pointer_t = ElemT*;
using element_t = ElemT; using element_t = ElemT;
@@ -64,28 +64,28 @@ struct __ptr_traits_ptr_to<ElemT*, ElemT, false>
// underlying implementation for classes that behave like pointers // underlying implementation for classes that behave like pointers
template<typename ClassT, typename ElemT, bool_t = is_void_v<ElemT>> template<typename ClassT, typename ElemT, bool_t = is_void_v<ElemT>>
struct __ptr_traits_impl : __ptr_traits_ptr_to<ClassT, ElemT> struct _ptr_traits_impl : _ptr_traits_ptr_to<ClassT, ElemT>
{ {
private: private:
template<typename TypeT> template<typename TypeT>
using __diff_t = typename TypeT::diff_t; // Helper to prevent substitution issues with detecting the difference type using _diff_t = typename TypeT::diff_t; // Helper to prevent substitution issues with detecting the difference type
template<typename BaseT, typename OElemT> // Helper to prevent substitution issues with detecting a defined rebind template<typename BaseT, typename OElemT> // Helper to prevent substitution issues with detecting a defined rebind
using __rebind_helper = type_identity<typename BaseT::template rebind<OElemT>>; using _rebind_helper = type_identity<typename BaseT::template rebind<OElemT>>;
public: public:
using pointer_t = ClassT; using pointer_t = ClassT;
using element_t = __ptr_get_element<ClassT>; using element_t = _ptr_get_element<ClassT>;
using diff_t = __diff_t<ClassT>; using diff_t = _diff_t<ClassT>;
template<class U> using rebind = detect_t<replace_first_element<ClassT, U>, __rebind_helper, ClassT, ElemT>; template<class U> using rebind = detect_t<replace_first_element<ClassT, U>, _rebind_helper, ClassT, ElemT>;
}; };
// overload for an undefined type // overload for an undefined type
template<typename ClassT> struct __ptr_traits_impl<ClassT, undefined_t> {}; template<typename ClassT> struct _ptr_traits_impl<ClassT, undefined_t> {};
// overload for void element // overload for void element
template<typename PtrT, typename ElemT> struct __ptr_traits_ptr_to<PtrT, ElemT, true> { }; template<typename PtrT, typename ElemT> struct _ptr_traits_ptr_to<PtrT, ElemT, true> { };
} }

View File

@@ -20,7 +20,7 @@
#define FENNEC_MEMORY_PTR_TRAITS_H #define FENNEC_MEMORY_PTR_TRAITS_H
#include <fennec/lang/types.h> #include <fennec/lang/types.h>
#include <fennec/memory/detail/__ptr_traits.h> #include <fennec/memory/detail/_ptr_traits.h>
namespace fennec namespace fennec
{ {
@@ -30,11 +30,11 @@ namespace fennec
/// \tparam ClassT The Pointer class type /// \tparam ClassT The Pointer class type
template<typename ClassT> template<typename ClassT>
struct ptr_traits struct ptr_traits
: detail::__ptr_traits_impl<ClassT, detail::__ptr_get_element<ClassT>> {}; : detail::_ptr_traits_impl<ClassT, detail::_ptr_get_element<ClassT>> {};
// overload for C-Style Pointers // overload for C-Style Pointers
template<typename ElemT> template<typename ElemT>
struct ptr_traits<ElemT*> : detail::__ptr_traits_ptr_to<ElemT*, ElemT> struct ptr_traits<ElemT*> : detail::_ptr_traits_ptr_to<ElemT*, ElemT>
{ {
using pointer_t = ElemT*; using pointer_t = ElemT*;
using element_t = ElemT; using element_t = ElemT;

View File

@@ -19,7 +19,7 @@
#include <stdio.h> #include <stdio.h>
#include <cpptrace/cpptrace.hpp> #include <cpptrace/cpptrace.hpp>
void __assert_callback(const char* expression, const char* file, int line, const char* function, const char* description) void _assert_callback(const char* expression, const char* file, int line, const char* function, const char* description)
{ {
// Skip // Skip
// __assert_callback // __assert_callback

View File

@@ -16,15 +16,15 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
// ===================================================================================================================== // =====================================================================================================================
#include <fennec/lang/detail/__stdlib.h> #include <fennec/lang/detail/_stdlib.h>
using assert_handler = void (*)(const char *, const char *, int , const char *); using assert_handler = void (*)(const char *, const char *, int , const char *);
void __assert_callback(const char* expression, const char* file, int line, const char* function, const char* description); void _assert_callback(const char* expression, const char* file, int line, const char* function, const char* description);
void __assert_impl(const char* expression, const char* file, int line, const char* function, const char* description, bool halt) void _assert_impl(const char* expression, const char* file, int line, const char* function, const char* description, bool halt)
{ {
__assert_callback(expression, file, line, function, description); _assert_callback(expression, file, line, function, description);
if (halt) { if (halt) {
::abort(); ::abort();

View File

@@ -16,7 +16,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
// ===================================================================================================================== // =====================================================================================================================
#include <fennec/lang/detail/__stdlib.h> #include <fennec/lang/detail/_stdlib.h>
#include <fennec/memory/new.h> #include <fennec/memory/new.h>

View File

@@ -20,7 +20,7 @@
#ifndef FENNEC_TEST_MATRIX_H #ifndef FENNEC_TEST_MATRIX_H
#define FENNEC_TEST_MATRIX_H #define FENNEC_TEST_MATRIX_H
#include <fennec/math/detail/__fwd.h> #include <fennec/math/detail/_fwd.h>
#include <fennec/math/matrix.h> #include <fennec/math/matrix.h>