From d9ad33c3a54488a2d7185dd56a3efb60a56fbbac Mon Sep 17 00:00:00 2001 From: Vincent van Ecchi Date: Sat, 4 Jan 2025 10:31:57 +0100 Subject: [PATCH] [Examples/Website] treat RenderCommand.commandType as uint8_t instead of uint32_t --- examples/clay-official-website/index.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/clay-official-website/index.html b/examples/clay-official-website/index.html index d9271a8..497f52a 100644 --- a/examples/clay-official-website/index.html +++ b/examples/clay-official-website/index.html @@ -426,7 +426,8 @@ element.style.height = Math.round(renderCommand.boundingBox.height.value) + 'px'; } - switch(renderCommand.commandType.value) { + // note: commandType is packed to uint8_t and has 3 garbage bytes of padding + switch(renderCommand.commandType.value & 0xff) { case (CLAY_RENDER_COMMAND_TYPE_NONE): { break; } @@ -580,7 +581,9 @@ for (let i = 0; i < length; i++, arrayOffset += renderCommandSize) { let renderCommand = readStructAtAddress(arrayOffset, renderCommandDefinition); let boundingBox = renderCommand.boundingBox; - switch(renderCommand.commandType.value) { + + // note: commandType is packed to uint8_t and has 3 garbage bytes of padding + switch(renderCommand.commandType.value & 0xff) { case (CLAY_RENDER_COMMAND_TYPE_NONE): { break; }