You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looks possibly related to #2250. I wouldn't be surprised since both left and right shifts use the same pow method internally.
This may help but if all operands to the bitshift expression are variables then it works, so this is fine:
// Worksfnbitshift_variable(base:u64,idx:u64) -> u64{letmut bits:u64 = 0;
bits |= base << idx;// Same as in OP, literal `1` replaced with `base`.
bits
}
Probably something to do with constant expression optimisation or something? I'm not too familiar with the compiler internals. I had a gander but nothing obvious to me.
Aim
To bitshift by values only known at runtime.
Expected Behavior
I'd expect this suite of tests to pass:
Bug
Function
bitshift_variable
fails with:To Reproduce
Installation Method
Binary
Nargo Version
nargo 0.10.3 (git version hash: 2db759f, is dirty: false)
Additional Context
nargo 0.9.0 (git version hash: ef91286b920fb3e17c7368839a93ccad2441edc8, is dirty: false)
Would you like to submit a PR for this Issue?
No
Support Needs
No response
The text was updated successfully, but these errors were encountered: