-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
add @bitSizeOf #2177
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
Comments
I ran into this working on mem.copy 27e2589 |
I was thinking Would this work? What would it break? And if this works, we could consider a tri-state type, that would be u2 alone, but fit five-to-a-byte when packed. |
However there is a concept of bit size, which corresponds in stage1 to
Can you elaborate on your use case? |
The idea is to support more compact packing. This may not belong in the language at all, but I'm thinking of how we would do it. It would be a significant change to the language to allow sub-byte packings, as certain assumptions would break, such as using Again, this could all be done in user-space, so it is mostly an idea. If we don't support the assumptions that would break should be documented as assumptions that can be relied on. Basically this is an ask for a |
Also |
|
I can't find a detailed reason why this is needed over erroring if we can't return a sensible result. Types are always comptime. Throwing an compile error when possible is part of the zen of zig, and prevents bugs. |
Currently we can't pack []u1 less that a byte for example. This would be a requirement to do that.
The text was updated successfully, but these errors were encountered: