Skip to content

Conversation

@GMMan
Copy link

@GMMan GMMan commented Mar 30, 2022

On platforms where the minimum memory access size is larger than a byte (case in point, μ'nSP where each address refers to one 16-bit word rather than a byte), indexing would never work due to the index buffer being initialized improperly. Instead of each element being initialized to -1 as would typically happen on a system with byte sized access, it gets initialized to 255. This breaks the indexing logic and causes it to go into an infinite loop.

This patch changes the initializer from 0xff to -1, so depending on the platform it should always initialize the entire array with -1. On byte access systems, memset() will truncate the -1 to 0xff as per standard, which results in the same desired behavior.

@silentbicycle
Copy link
Collaborator

Thanks, this will be cherry-picked to the develop branch for the next versioned release.

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.

2 participants