Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sysaudio: @sizeOf(T) is not the same as @bitSizeOf(T) #1200

Open
ypsvlq opened this issue Apr 30, 2024 · 0 comments
Open

sysaudio: @sizeOf(T) is not the same as @bitSizeOf(T) #1200

ypsvlq opened this issue Apr 30, 2024 · 0 comments
Labels
bug Something isn't working needs-triage Issues that need triaging

Comments

@ypsvlq
Copy link

ypsvlq commented Apr 30, 2024

In #1152, @sizeOf(i24) == 4 was considered a Zig bug, but the Zig documentation suggests this is not the case:

This size may contain padding bytes. If there were two consecutive T in memory, the padding would be the offset in bytes between element at index 0 and the element at index 1. For integer, consider whether you want to use @sizeOf(T) or @typeInfo(T).Int.bits.

The correct approach presumably involves using std.PackedIntSlice or similar in convert{To,From}, but exactly how this should be implemented is not clear. Alternatively, it might be possible to replace i24 with i24_4b (removed in hexops/mach-sysaudio@0a6bb12) (EDIT: after minor testing this does not seem to work)

@ypsvlq ypsvlq added bug Something isn't working needs-triage Issues that need triaging labels Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage Issues that need triaging
Projects
None yet
Development

No branches or pull requests

1 participant