diff options
author | Reid Barton <rwbarton@gmail.com> | 2015-07-25 23:01:49 -0400 |
---|---|---|
committer | Reid Barton <rwbarton@gmail.com> | 2015-07-25 23:01:49 -0400 |
commit | c55f61ca3f008cc70911d962297fb51f84056661 (patch) | |
tree | e6bfc0a4dbb7d08bd89b703594e1223928cd226e /compiler/codeGen | |
parent | 7e70c063ad88052ca5f2586eb07e5d1571956acd (diff) | |
download | haskell-c55f61ca3f008cc70911d962297fb51f84056661.tar.gz |
Add missing parentheses in eqBigNatWord#
Summary:
I'm pretty sure that parentheses were intended here. But oddly, they
make very little difference.
The presumably intended expression
(sizeofBigNat# bn ==# 1#) `andI#` (bigNatToWord bn `eqWord#` w#)
is 1# exactly when bn consists of a single limb equal to w#, clearly.
In the original expression
sizeofBigNat# bn ==# 1# `andI#` (bigNatToWord bn `eqWord#` w#)
the right-hand side of ==# is always 0# or 1#. So it is 1# when bn
consists of a single limb equal to w#. It is also 1# when bn has
zero limbs and the word past the end of bn does not happen to be
equal to w#. So in practice the difference is that nullBigNat was
eqBigNatWord# to almost everything, but eqBigNatWord# is never
supposed to be called on nullBigNat anyways.
Note that even the corrected version might perform an out-of-bounds
memory access if passed nullBigNat, because `andI#` is not guaranteed
to short-circuit, though in fact GHC does convert isZeroBigNat to a
series of branches in my local build.
Test Plan: validate
Reviewers: hvr, bgamari, goldfire, austin
Reviewed By: hvr, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1095
Diffstat (limited to 'compiler/codeGen')
0 files changed, 0 insertions, 0 deletions