-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add return length assert #19
Comments
@olehmisar good point! I think that this exact fix won't work for the non-padding case, only for padding (which is the standard setting), but I will update it in the code to make padding optional that I mentioned in #15 , since it adds support for padding and addresses a similar error, and we can put in a slightly different assert for the non-padding case. (I'm just waiting for #18 to be merged to be merged so I can open a PR for the padding fix and then the follow-up for the base64url) |
the ideal will be to compute |
@grjte arithmetic ops are already supported on generics. But only them. You need |
Having support for arbitrary comptime functions in generics is definitely not on the roadmap. |
No, you have to ceil it |
@TomAFrench if conditions were supported in generics, it would be written as: fn decode<let N: u32>(input: N) -> [(N / 3 + if N % 3 == 0 { 0 } else { 1 }) * 4)] { ... } |
helpful clarifications, thanks. Sounds like that inline comment should go away |
In this case @olehmisar I'm just going to push the change to add padding and then alphabet support as they're already written to avoid making the PRs more complex & I'll leave this bug open |
@TomAFrench oh yeah, you are absolutely right, |
Just saw this - should be fixed for both pad/non-pad once this is merged |
To prevent fools (like me) from shooting themselves in the foot.
Add this assert:
Add this check for encode and decode. You can grab
dev_ceil
implementation here.https://github.com/grjte/noir_base64/blob/eb933f20b8175132f8e965e519b98c41ad805af1/src/lib.nr#L100
The text was updated successfully, but these errors were encountered: