implementing last functions, adding put pixel region

This commit is contained in:
Kbz-8
2024-12-16 16:13:44 +01:00
parent ab4d67d764
commit 4987a8ca6e
10 changed files with 201 additions and 18 deletions

16
runtime/Includes/Utils/Bits.h git.filemode.normal_file
View 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