Skip to content

Document behavior of shiftR a n when n > BitSize a or negative #2959

@martijnbastiaan

Description

@martijnbastiaan

shiftR's documentation:

Shift the first argument right by the specified number of bits. The result is undefined for negative shift amounts and shift amounts greater or equal to the bitSize. Some instances may throw an Overflow exception if given a negative input.

We have picked specific behavior:

  • Undefined / errorX on negative shifts
  • shiftR a n == shiftR a (BitSize a), for all n > BitSize a

Given that we can't really go back (at least according to my strong belief that API conserving behavioral changes are not-done), we should document this.

Edit: this should be done per-instance. I only looked at Unsigned :-).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions