Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
clean-and-itasks
clean-platform
Commits
6d8885a4
Verified
Commit
6d8885a4
authored
Apr 04, 2020
by
Camil Staps
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the 32-bit encodeReal and decodeReal in Data.Encoding.GenBinary
parent
64644eef
Pipeline
#40943
passed with stage
in 1 minute and 53 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
src/libraries/OS-Independent/Data/Encoding/GenBinary.icl
src/libraries/OS-Independent/Data/Encoding/GenBinary.icl
+12
-2
No files found.
src/libraries/OS-Independent/Data/Encoding/GenBinary.icl
View file @
6d8885a4
...
...
@@ -53,7 +53,12 @@ encodeBool True cs=:{es_pos = pos, es_bits = bits}
encodeReal
::
!
Real
!*
EncodingSt
->
*
EncodingSt
encodeReal
real
st
=
IF_INT_64_OR_32
(
encodeInt
(
unsafeCoerce
real
)
st
)
(
let
(
i1
,
i2
)
=
unsafeCoerce
real
in
encodeInt
i2
$
encodeInt
i1
st
)
(
let
(
i1
,
i2
)
=
realToInts
real
in
encodeInt
i2
$
encodeInt
i1
st
)
where
realToInts
::
!
Real
->
(!
Int
,
!
Int
)
realToInts
_
=
code {
no_op
}
encodeArray
::
!(
a
*
EncodingSt
->
*
EncodingSt
)
!(
b
a
)
!*
EncodingSt
->
*
EncodingSt
|
Array
b
a
encodeArray
f
xs
st
...
...
@@ -161,8 +166,13 @@ where
#
(
mbInt1
,
st
)
=
decodeInt
st
#
(
mbInt2
,
st
)
=
decodeInt
st
=
case
(
mbInt1
,
mbInt2
)
of
(
Just
int1
,
Just
int2
)
=
(
Just
$
unsafeCoerce
(
int1
,
int2
)
,
st
)
(
Just
int1
,
Just
int2
)
=
(
Just
$
intsToReal
int1
int2
,
st
)
_
=
(
Nothing
,
st
)
where
intsToReal
::
!
Int
!
Int
->
Real
intsToReal
_
_
=
code {
no_op
}
decodeArray
::
!(*
EncodingSt
->
(
Maybe
a
,
*
EncodingSt
))
!*
EncodingSt
->
(!
Maybe
(
b
a
),
!*
EncodingSt
)
|
Array
b
a
decodeArray
f
st
...
...
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