- Fixed up some style issues

- Added PLANNING.md
This commit is contained in:
2025-06-13 01:44:48 -04:00
parent e50cfb6e64
commit fae7f601c9
6 changed files with 211 additions and 6 deletions

View File

@@ -0,0 +1,51 @@
// =====================================================================================================================
// fennec, a free and open source game engine
// Copyright (C) 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_BITS_H
#define FENNEC_LANG_BITS_H
#include <fennec/lang/intrinsics.h>
#include <fennec/memory/memory.h>
namespace fennec
{
///
/// \fn fennec::bit_cast(const FromT&)
/// \brief
/// \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
template<typename ToT, typename FromT> requires(sizeof(ToT) == sizeof(FromT))
constexpr ToT bit_cast(const FromT& from)
{
if constexpr(FENNEC_HAS_BUILTIN_BIT_CAST)
return FENNEC_BUILTIN_BIT_CAST(ToT, from);
else
{
ToT to;
memcpy(&to, &from, sizeof(ToT));
return to;
}
}
}
#endif // FENNEC_LANG_BITS_H