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

'shl' and 'shr' inconsistency when shifting with value >= bitsof(left operand) #95

Open
jangko opened this issue Oct 22, 2019 · 0 comments

Comments

@jangko
Copy link
Contributor

jangko commented Oct 22, 2019

this is actually Nim 'shl'/'shr' inconsistency, but it also reflected by stint.

'shl' inconsistency:

  • 1.u256 shl 256 runtime will produce 0
  • 1.u256 shl 256 compiletime will produce 1

on the other hand shr at runtime and compiletime will will produce 0 if we shift beyond number of bits of the left operand.

probably signed integer version also suffered from this.
there is no documentation and tests for this gray area.
related Nim PR nim-lang/Nim#11555

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

No branches or pull requests

1 participant