Skip to content

Fix #1995: right shift should be logical when first operand is unsigned - #2072

Merged
sklam merged 1 commit into
numba:masterfrom
pitrou:unsigned_right_shift
Sep 1, 2016
Merged

sklam merged 1 commit into
numba:masterfrom
pitrou:unsigned_right_shift

Conversation

@pitrou

@pitrou pitrou commented Sep 1, 2016 •

Copy link
Copy Markdown
Contributor

This changes the rules for bitshift operations: only the first operand matters for signedness, so that e.g. unsigned >> 2 will be considered unsigned and not signed.

Note that Numpy is much more annoying:

>>> np.uint64(18446744073709551615) >> 2
Traceback (most recent call last):
  File "<ipython-input-10-988f6401a88f>", line 1, in <module>
    np.uint64(18446744073709551615) >> 2
TypeError: ufunc 'right_shift' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

@codecov-io

codecov-io commented Sep 1, 2016 •

Copy link
Copy Markdown

Current coverage is 87.08% (diff: 100%)

Merging #2072 into master will increase coverage by <.01%

@@             master      #2072   diff @@
==========================================
  Files           305        305          
  Lines         55562      55565     +3   
  Methods           0          0          
  Messages          0          0          
  Branches       5752       5756     +4   
==========================================
+ Hits          48384      48387     +3   
  Misses         6242       6242          
  Partials        936        936          

Powered by Codecov. Last update fe99fbc...f94c120

@sklam

sklam commented Sep 1, 2016

Copy link
Copy Markdown
Member

Looks good

@sklam
sklam merged commit 011b8e4 into numba:master Sep 1, 2016
@sklam sklam modified the milestone: Numba 0.29 Sep 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants