From 561b6c9ec9e94937af4ba298b938d01a077c0f6f Mon Sep 17 00:00:00 2001 From: Patrick Stotko Date: Tue, 25 Oct 2022 15:26:48 +0200 Subject: [PATCH] bit: Use std::byte in bit_cast implementation --- src/stdgpu/impl/bit_detail.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/stdgpu/impl/bit_detail.h b/src/stdgpu/impl/bit_detail.h index dc285f4c1..b06abcabf 100644 --- a/src/stdgpu/impl/bit_detail.h +++ b/src/stdgpu/impl/bit_detail.h @@ -16,6 +16,8 @@ #ifndef STDGPU_BIT_DETAIL_H #define STDGPU_BIT_DETAIL_H +#include + #include #include @@ -136,12 +138,12 @@ bit_cast(const From& object) To result; // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) - auto* result_bytes = reinterpret_cast(&result); + auto* result_bytes = reinterpret_cast(&result); // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) - const auto* object_bytes = reinterpret_cast(&object); + const auto* object_bytes = reinterpret_cast(&object); - for (unsigned int i = 0; i < sizeof(To); ++i) + for (std::size_t i = 0; i < sizeof(To); ++i) { result_bytes[i] = object_bytes[i]; }