mirror of
https://github.com/love2d/megasource.git
synced 2026-08-20 04:30:45 +02:00
update OpenAL-Soft to 1.24.3.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#ifndef AL_BIT_H
|
||||
#define AL_BIT_H
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#ifndef __GNUC__
|
||||
#include <cstdint>
|
||||
@@ -25,6 +26,16 @@ To> bit_cast(const From &src) noexcept
|
||||
return *std::launder(reinterpret_cast<To*>(dst.data()));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_integral_v<T>,
|
||||
T> byteswap(T value) noexcept
|
||||
{
|
||||
static_assert(std::has_unique_object_representations_v<T>);
|
||||
auto bytes = al::bit_cast<std::array<std::byte,sizeof(T)>>(value);
|
||||
std::reverse(bytes.begin(), bytes.end());
|
||||
return al::bit_cast<T>(bytes);
|
||||
}
|
||||
|
||||
#ifdef __BYTE_ORDER__
|
||||
enum class endian {
|
||||
little = __ORDER_LITTLE_ENDIAN__,
|
||||
|
||||
Reference in New Issue
Block a user