From 001939ca8e2c582650d3cd77d0cd0eabffc50ed2 Mon Sep 17 00:00:00 2001 From: skal Date: Tue, 17 Feb 2026 08:57:55 +0100 Subject: style: replace C++ casts with C-style casts Converts all static_cast<>, reinterpret_cast<> to C-style casts per CODING_STYLE.md guidelines. - Modified 12 files across gpu, 3d, util, tests, and tools - All builds passing, 34/34 tests passing - No functional changes, pure style cleanup Co-Authored-By: Claude Sonnet 4.5 --- tools/cnn_test.cc | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'tools/cnn_test.cc') diff --git a/tools/cnn_test.cc b/tools/cnn_test.cc index 25a1285..5694a62 100644 --- a/tools/cnn_test.cc +++ b/tools/cnn_test.cc @@ -176,7 +176,7 @@ static WGPUTexture load_texture(WGPUDevice device, WGPUQueue queue, .usage = WGPUTextureUsage_TextureBinding | WGPUTextureUsage_CopyDst | WGPUTextureUsage_RenderAttachment, .dimension = WGPUTextureDimension_2D, - .size = {static_cast(width), static_cast(height), 1}, + .size = {(uint32_t)(width), (uint32_t)(height), 1}, .format = WGPUTextureFormat_BGRA8Unorm, .mipLevelCount = 1, .sampleCount = 1, @@ -200,10 +200,10 @@ static WGPUTexture load_texture(WGPUDevice device, WGPUQueue queue, // Upload to GPU const WGPUTexelCopyTextureInfo dst = {.texture = texture, .mipLevel = 0}; const WGPUTexelCopyBufferLayout layout = { - .bytesPerRow = static_cast(width * 4), - .rowsPerImage = static_cast(height)}; - const WGPUExtent3D size = {static_cast(width), - static_cast(height), 1}; + .bytesPerRow = (uint32_t)(width * 4), + .rowsPerImage = (uint32_t)(height)}; + const WGPUExtent3D size = {(uint32_t)(width), + (uint32_t)(height), 1}; wgpuQueueWriteTexture(queue, &dst, bgra_data.data(), bgra_data.size(), &layout, &size); @@ -238,7 +238,7 @@ static WGPUTexture load_depth_from_alpha(WGPUDevice device, WGPUQueue queue, const WGPUTextureDescriptor depth_desc = { .usage = WGPUTextureUsage_TextureBinding | WGPUTextureUsage_CopyDst, .dimension = WGPUTextureDimension_2D, - .size = {static_cast(width), static_cast(height), 1}, + .size = {(uint32_t)(width), (uint32_t)(height), 1}, .format = WGPUTextureFormat_R32Float, .mipLevelCount = 1, .sampleCount = 1, @@ -253,10 +253,10 @@ static WGPUTexture load_depth_from_alpha(WGPUDevice device, WGPUQueue queue, const WGPUTexelCopyTextureInfo dst = {.texture = depth_texture, .mipLevel = 0}; const WGPUTexelCopyBufferLayout layout = { - .bytesPerRow = static_cast(width * sizeof(float)), - .rowsPerImage = static_cast(height)}; - const WGPUExtent3D size = {static_cast(width), - static_cast(height), 1}; + .bytesPerRow = (uint32_t)(width * sizeof(float)), + .rowsPerImage = (uint32_t)(height)}; + const WGPUExtent3D size = {(uint32_t)(width), + (uint32_t)(height), 1}; wgpuQueueWriteTexture(queue, &dst, depth_data.data(), depth_data.size() * sizeof(float), &layout, &size); @@ -474,8 +474,8 @@ readback_rgba32uint_to_bgra8(WGPUDevice device, WGPUQueue queue, dst.layout.bytesPerRow = padded_bytes_per_row; dst.layout.rowsPerImage = height; - WGPUExtent3D copy_size = {static_cast(width), - static_cast(height), 1}; + WGPUExtent3D copy_size = {(uint32_t)(width), + (uint32_t)(height), 1}; wgpuCommandEncoderCopyTextureToBuffer(encoder, &src, &dst, ©_size); @@ -575,7 +575,7 @@ readback_rgba32uint_to_bgra8(WGPUDevice device, WGPUQueue queue, return 0; if (v >= 1.0f) return 255; - return static_cast(v * 255.0f + 0.5f); + return (uint8_t)(v * 255.0f + 0.5f); }; result[(y * width + x) * 4 + 0] = clamp_u8(b); @@ -743,7 +743,7 @@ static bool process_cnn_v2(WGPUDevice device, WGPUQueue queue, .usage = WGPUTextureUsage_StorageBinding | WGPUTextureUsage_TextureBinding | WGPUTextureUsage_CopySrc, .dimension = WGPUTextureDimension_2D, - .size = {static_cast(width), static_cast(height), 1}, + .size = {(uint32_t)(width), (uint32_t)(height), 1}, .format = WGPUTextureFormat_RGBA32Uint, .mipLevelCount = 1, .sampleCount = 1, @@ -1350,7 +1350,7 @@ int main(int argc, char** argv) { .usage = WGPUTextureUsage_TextureBinding | WGPUTextureUsage_RenderAttachment | WGPUTextureUsage_CopySrc, .dimension = WGPUTextureDimension_2D, - .size = {static_cast(width), static_cast(height), 1}, + .size = {(uint32_t)(width), (uint32_t)(height), 1}, .format = WGPUTextureFormat_RGBA16Float, .mipLevelCount = 1, .sampleCount = 1, @@ -1385,8 +1385,8 @@ int main(int argc, char** argv) { // Update uniforms UniformsSequenceParams common_u = { - .resolution = {static_cast(width), static_cast(height)}, - .aspect_ratio = static_cast(width) / static_cast(height), + .resolution = {(float)(width), (float)(height)}, + .aspect_ratio = (float)(width) / (float)(height), .time = 0.0f, .beat_time = 0.0f, .beat_phase = 0.0f, -- cgit v1.2.3