mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-12 23:23:34 +00:00
implementing last functions, adding put pixel region
This commit is contained in:
16
runtime/Includes/Utils/Bits.h
git.filemode.normal_file
16
runtime/Includes/Utils/Bits.h
git.filemode.normal_file
@@ -0,0 +1,16 @@
|
||||
#ifndef __MLX_BITS__
|
||||
#define __MLX_BITS__
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
template<std::integral T>
|
||||
constexpr T ByteSwap(T value) noexcept
|
||||
{
|
||||
static_assert(std::has_unique_object_representations_v<T>, "T may not have padding bits");
|
||||
auto value_representation = std::bit_cast<std::array<std::byte, sizeof(T)>>(value);
|
||||
std::ranges::reverse(value_representation);
|
||||
return std::bit_cast<T>(value_representation);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user