Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sv2v
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
sv2v
Commits
80984f7e
Commit
80984f7e
authored
Feb 17, 2020
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
size casts on decimal numbers are simplified
parent
5f0ccee0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
src/Convert/SizeCast.hs
+17
-2
No files found.
src/Convert/SizeCast.hs
View file @
80984f7e
...
@@ -59,7 +59,23 @@ traverseExprM =
...
@@ -59,7 +59,23 @@ traverseExprM =
traverseNestedExprsM
convertExprM
traverseNestedExprsM
convertExprM
where
where
convertExprM
::
Expr
->
ST
Expr
convertExprM
::
Expr
->
ST
Expr
convertExprM
(
Cast
(
Right
s
)
e
)
=
do
convertExprM
(
Cast
(
Right
(
Number
s
))
(
Number
n
))
=
case
(
readNumber
s
,
readNumber
n
)
of
(
Just
s'
,
Just
n'
)
->
return
$
Number
str
where
str
=
(
show
size
)
++
"'d"
++
(
show
num
)
size
=
s'
num
=
n'
`
mod
`
(
2
^
s'
)
_
->
convertCastM
(
Number
s
)
(
Number
n
)
convertExprM
(
orig
@
(
Cast
(
Right
DimsFn
{})
_
))
=
return
orig
convertExprM
(
Cast
(
Right
s
)
e
)
=
convertCastM
s
e
convertExprM
other
=
return
other
convertCastM
::
Expr
->
Expr
->
ST
Expr
convertCastM
s
e
=
do
typeMap
<-
get
typeMap
<-
get
case
exprSigning
typeMap
e
of
case
exprSigning
typeMap
e
of
Just
sg
->
do
Just
sg
->
do
...
@@ -68,7 +84,6 @@ traverseExprM =
...
@@ -68,7 +84,6 @@ traverseExprM =
let
args
=
Args
[
Just
e
]
[]
let
args
=
Args
[
Just
e
]
[]
return
$
Call
(
Ident
f
)
args
return
$
Call
(
Ident
f
)
args
_
->
return
$
Cast
(
Right
s
)
e
_
->
return
$
Cast
(
Right
s
)
e
convertExprM
other
=
return
other
castFn
::
Expr
->
Signing
->
Description
castFn
::
Expr
->
Signing
->
Description
...
...
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