- Added unit tests and debugged them
This commit is contained in:
27
include/fennec/lang/detail/__int.h
Normal file
27
include/fennec/lang/detail/__int.h
Normal file
@@ -0,0 +1,27 @@
|
||||
// =====================================================================================================================
|
||||
// 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_INT_H
|
||||
#define FENNEC_LANG_DETAIL_INT_H
|
||||
|
||||
#pragma push_macro("__cplusplus")
|
||||
#undef __cplusplus
|
||||
#include <stdint.h>
|
||||
#pragma pop_macro("__cplusplus")
|
||||
|
||||
#endif // FENNEC_LANG_DETAIL_INT_H
|
||||
29
include/fennec/lang/detail/__stdlib.h
Normal file
29
include/fennec/lang/detail/__stdlib.h
Normal file
@@ -0,0 +1,29 @@
|
||||
// =====================================================================================================================
|
||||
// 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_STDLIB_H
|
||||
#define FENNEC_LANG_DETAIL_STDLIB_H
|
||||
|
||||
#pragma push_macro("__cplusplus")
|
||||
#undef __cplusplus
|
||||
extern "C" {
|
||||
#include <stdlib.h>
|
||||
}
|
||||
#pragma pop_macro("__cplusplus")
|
||||
|
||||
#endif // FENNEC_LANG_DETAIL_STDLIB_H
|
||||
@@ -201,8 +201,6 @@
|
||||
///
|
||||
///
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <fennec/lang/types.h>
|
||||
#include <fennec/lang/type_traits.h>
|
||||
|
||||
|
||||
@@ -203,23 +203,23 @@ template<typename SequenceT0, typename SequenceT1> using concat_sequence_t
|
||||
|
||||
// Internal ============================================================================================================
|
||||
|
||||
// Implementation for Generating an \ref integer_sequence
|
||||
// Implementation for Generating an integer_sequence
|
||||
template<typename T, size_t N> struct make_integer_sequence : concat_sequence_t<make_integer_sequence_t<T, N / 2>, make_integer_sequence_t<T, N - N / 2>>{};
|
||||
|
||||
// Base Case of \f$N=0\f$
|
||||
// Base Case of N=0
|
||||
template<typename T> struct make_integer_sequence<T, 0> : integer_sequence<T> {};
|
||||
|
||||
// Base Case of \f$N=1\f$
|
||||
// Base Case of N=1
|
||||
template<typename T> struct make_integer_sequence<T, 1> : integer_sequence<T, 0>{};
|
||||
|
||||
|
||||
// Implementation for Generating an \ref integer_sequence
|
||||
// Implementation for Generating an index_sequence
|
||||
template<size_t N> struct make_index_sequence : concat_sequence_t<make_index_sequence_t<N / 2>, make_index_sequence_t<N - N / 2>>{};
|
||||
|
||||
// Base Case of \f$N=0\f$
|
||||
// Base Case of N=0
|
||||
template<> struct make_index_sequence<0> : index_sequence<> {};
|
||||
|
||||
// Base Case of \f$N=1\f$
|
||||
// Base Case of N=1
|
||||
template<> struct make_index_sequence<1> : index_sequence<0>{};
|
||||
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@
|
||||
///
|
||||
///
|
||||
|
||||
#include <cstdint>
|
||||
#include <fennec/lang/detail/__int.h>
|
||||
|
||||
namespace fennec
|
||||
{
|
||||
|
||||
@@ -72,10 +72,10 @@ namespace fennec
|
||||
/// \tparam T base type of the object
|
||||
/// \param x reference to the object
|
||||
/// \returns
|
||||
template<typename T> constexpr T&& forward(remove_reference_t<T>& x) noexcept { return x; }
|
||||
template<typename T> constexpr T&& forward(remove_reference_t<T>& x) noexcept { return static_cast<T&&>(x); }
|
||||
|
||||
// specialization for T&&
|
||||
template<typename T> constexpr T&& forward(remove_reference_t<T>&& x) noexcept { return x; }
|
||||
template<typename T> constexpr T&& forward(remove_reference_t<T>&& x) noexcept { return static_cast<T&&>(x); }
|
||||
|
||||
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user