diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-17 08:57:55 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-17 08:57:55 +0100 |
| commit | 001939ca8e2c582650d3cd77d0cd0eabffc50ed2 (patch) | |
| tree | 7363271308b3e53c2495f1973a62ae42ab10cd37 /tools/cnn_test.cc | |
| parent | 59b7ca9adff07f8d457fba53ba4d67c293229b68 (diff) | |
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 <noreply@anthropic.com>
Diffstat (limited to 'tools/cnn_test.cc')
| -rw-r--r-- | tools/cnn_test.cc | 34 |
1 files changed, 17 insertions, 17 deletions
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<uint32_t>(width), static_cast<uint32_t>(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<uint32_t>(width * 4), - .rowsPerImage = static_cast<uint32_t>(height)}; - const WGPUExtent3D size = {static_cast<uint32_t>(width), - static_cast<uint32_t>(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<uint32_t>(width), static_cast<uint32_t>(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<uint32_t>(width * sizeof(float)), - .rowsPerImage = static_cast<uint32_t>(height)}; - const WGPUExtent3D size = {static_cast<uint32_t>(width), - static_cast<uint32_t>(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<uint32_t>(width), - static_cast<uint32_t>(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<uint8_t>(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<uint32_t>(width), static_cast<uint32_t>(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<uint32_t>(width), static_cast<uint32_t>(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<float>(width), static_cast<float>(height)}, - .aspect_ratio = static_cast<float>(width) / static_cast<float>(height), + .resolution = {(float)(width), (float)(height)}, + .aspect_ratio = (float)(width) / (float)(height), .time = 0.0f, .beat_time = 0.0f, .beat_phase = 0.0f, |
