mirror of
https://github.com/love2d/megasource.git
synced 2026-08-19 12:14:41 +02:00
Update OpenAL-soft to 1.23.1-bc7cb17.
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
#ifndef AL_BIT_H
|
||||
#define AL_BIT_H
|
||||
|
||||
#include <array>
|
||||
#ifndef __GNUC__
|
||||
#include <cstdint>
|
||||
#endif
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <new>
|
||||
#include <type_traits>
|
||||
#if !defined(__GNUC__) && (defined(_WIN32) || defined(_WIN64))
|
||||
#include <intrin.h>
|
||||
@@ -10,6 +15,16 @@
|
||||
|
||||
namespace al {
|
||||
|
||||
template<typename To, typename From>
|
||||
std::enable_if_t<sizeof(To) == sizeof(From) && std::is_trivially_copyable_v<From>
|
||||
&& std::is_trivially_copyable_v<To>,
|
||||
To> bit_cast(const From &src) noexcept
|
||||
{
|
||||
alignas(To) std::array<char,sizeof(To)> dst;
|
||||
std::memcpy(dst.data(), &src, sizeof(To));
|
||||
return *std::launder(reinterpret_cast<To*>(dst.data()));
|
||||
}
|
||||
|
||||
#ifdef __BYTE_ORDER__
|
||||
enum class endian {
|
||||
little = __ORDER_LITTLE_ENDIAN__,
|
||||
|
||||
Reference in New Issue
Block a user