Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
4,269
Issues
4,269
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
413
Merge Requests
413
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
27544196
Commit
27544196
authored
Jan 05, 2021
by
Sylvain Henry
Committed by
Marge Bot
Jan 09, 2021
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Natural: fix left shift of 0 (fix #19170)
parent
9163b3f1
Pipeline
#29711
canceled with stages
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
1 deletion
+17
-1
libraries/ghc-bignum/src/GHC/Num/Natural.hs
libraries/ghc-bignum/src/GHC/Num/Natural.hs
+2
-1
testsuite/tests/lib/integer/T19170.hs
testsuite/tests/lib/integer/T19170.hs
+11
-0
testsuite/tests/lib/integer/T19170.stdout
testsuite/tests/lib/integer/T19170.stdout
+3
-0
testsuite/tests/lib/integer/all.T
testsuite/tests/lib/integer/all.T
+1
-0
No files found.
libraries/ghc-bignum/src/GHC/Num/Natural.hs
View file @
27544196
...
...
@@ -239,7 +239,8 @@ naturalShiftR x (W# n) = naturalShiftR# x n
-- | Left shift
naturalShiftL
#
::
Natural
->
Word
#
->
Natural
naturalShiftL
#
(
NS
x
)
n
naturalShiftL
#
v
@
(
NS
x
)
n
|
0
##
<-
x
=
v
|
isTrue
#
(
clz
#
x
`
geWord
#
`
n
)
=
NS
(
x
`
uncheckedShiftL
#
`
word2Int
#
n
)
|
True
=
NB
(
bigNatFromWord
#
x
`
bigNatShiftL
#
`
n
)
naturalShiftL
#
(
NB
x
)
n
=
NB
(
x
`
bigNatShiftL
#
`
n
)
...
...
testsuite/tests/lib/integer/T19170.hs
0 → 100644
View file @
27544196
module
Main
where
import
Data.Bits
import
GHC.Natural
import
GHC.Num.Natural
main
::
IO
()
main
=
do
print
$
(
shiftL
0
65
::
Natural
)
print
$
naturalCheck
(
shiftL
0
65
::
Natural
)
print
$
shiftL
0
65
==
(
0
::
Natural
)
testsuite/tests/lib/integer/T19170.stdout
0 → 100644
View file @
27544196
0
True
True
testsuite/tests/lib/integer/all.T
View file @
27544196
...
...
@@ -12,6 +12,7 @@ test('integerGcdExt', [], compile_and_run, [''])
test
('
integerRecipMod
',
[]
,
compile_and_run
,
[''])
test
('
bignumMatch
',
[]
,
compile
,
[''])
test
('
T18813
',
[]
,
compile_and_run
,
[''])
test
('
T19170
',
[]
,
compile_and_run
,
[''])
# skip ghci as it doesn't support unboxed tuples
test
('
integerImportExport
',
[
omit_ways
(['
ghci
'])],
compile_and_run
,
[''])
...
...
Marge Bot
💬
@marge-bot
mentioned in merge request
!4736 (closed)
·
Jan 10, 2021
mentioned in merge request
!4736 (closed)
mentioned in merge request !4736
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment