Skip to content

gfx: fix narrowing-conversion error on 32-bit targets - #307

Open
StilesCrisis wants to merge 1 commit into
encounter:mainfrom
StilesCrisis:fix-32bit-bytebuffer
Open

StilesCrisis wants to merge 1 commit into
encounter:mainfrom
StilesCrisis:fix-32bit-bytebuffer

Conversation

@StilesCrisis

@StilesCrisis StilesCrisis commented Nov 7, 2026 •

Copy link
Copy Markdown

On a 32-bit target (which is a natural first step for bringing up a GameCube game), size_t is 32 bits wide. Brace-initializing a ByteBuffer then fails because it's a narrowing conversion from 64- to 32-bit.

The simplest fix is to switch to paren-construction. This doesn't enforce the brace-initialization narrowing rule and passes -Wall -Wextra. If you are worried about tripping -Wconversion, you could also add an explicit static_cast.

calc_texture_size returns uint64_t, and brace-initializing a ByteBuffer
(which takes size_t) from it is a narrowing conversion, a hard error
where size_t is 32 bits (wasm32, armv7). Use parentheses instead; both
sizes are already validated against the source data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SjpWoYqNDKkH5Zpdbz3WaW
@StilesCrisis StilesCrisis changed the title gfx: fix texture replacement build on 32-bit targets gfx: fix narrowing-conversion error on 32-bit targets Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant