Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
binary
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yitang Chen
binary
Commits
ddee463e
Commit
ddee463e
authored
4 years ago
by
Moritz Angermann
Browse files
Options
Downloads
Patches
Plain Diff
[Cmm Sized] Adjust
parent
f9b1c92a
Branches
wip/angerman/sized-primitives
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
binary.cabal
+6
-2
6 additions, 2 deletions
binary.cabal
src/Data/Binary/Get.hs
+20
-6
20 additions, 6 deletions
src/Data/Binary/Get.hs
with
26 additions
and
8 deletions
binary.cabal
+
6
−
2
View file @
ddee463e
...
@@ -39,7 +39,11 @@ source-repository head
...
@@ -39,7 +39,11 @@ source-repository head
location: git://github.com/kolmodin/binary.git
location: git://github.com/kolmodin/binary.git
library
library
build-depends: base >= 4.5.0.0 && < 5, bytestring >= 0.10.4, containers, array
build-depends: base >= 4.5.0.0 && < 5,
ghc-prim >= 0.5.0 && <0.9,
bytestring >= 0.10.4,
containers,
array
hs-source-dirs: src
hs-source-dirs: src
exposed-modules: Data.Binary,
exposed-modules: Data.Binary,
Data.Binary.Put,
Data.Binary.Put,
...
@@ -181,7 +185,7 @@ benchmark generics-bench
...
@@ -181,7 +185,7 @@ benchmark generics-bench
unordered-containers,
unordered-containers,
zlib,
zlib,
criterion
criterion
other-modules:
other-modules:
Cabal24
Cabal24
GenericsBenchCache
GenericsBenchCache
...
...
This diff is collapsed.
Click to expand it.
src/Data/Binary/Get.hs
+
20
−
6
View file @
ddee463e
...
@@ -231,14 +231,28 @@ import qualified Data.ByteString.Lazy.Internal as L
...
@@ -231,14 +231,28 @@ import qualified Data.ByteString.Lazy.Internal as L
import
Data.Binary.Get.Internal
hiding
(
Decoder
(
..
),
runGetIncremental
)
import
Data.Binary.Get.Internal
hiding
(
Decoder
(
..
),
runGetIncremental
)
import
qualified
Data.Binary.Get.Internal
as
I
import
qualified
Data.Binary.Get.Internal
as
I
-- needed for casting words to float/double
import
Data.Binary.FloatCast
(
wordToFloat
,
wordToDouble
)
#
if
defined
(
__GLASGOW_HASKELL__
)
&&
!
defined
(
__HADDOCK__
)
#
if
defined
(
__GLASGOW_HASKELL__
)
&&
!
defined
(
__HADDOCK__
)
-- needed for (# unboxing #) with magic hash
-- needed for (# unboxing #) with magic hash
import
GHC.Base
import
GHC.Base
hiding
(
extendWord8
#
,
extendWord16
#
,
extendWord32
#
,
narrowWord8
#
,
narrowWord16
#
,
narrowWord32
#
)
import
GHC.Word
import
GHC.Word
#
if
MIN_VERSION_ghc_prim
(
0
,
8
,
0
)
import
GHC.Base
(
extendWord8
#
,
extendWord16
#
,
extendWord32
#
)
import
GHC.Base
(
narrowWord8
#
,
narrowWord16
#
,
narrowWord32
#
)
#
else
import
GHC.Prim
(
Word
#
)
extendWord8
#
,
extendWord16
#
,
extendWord32
#
::
Word
#
->
Word
#
narrowWord8
#
,
narrowWord16
#
,
narrowWord32
#
::
Word
#
->
Word
#
extendWord8
#
w
=
w
extendWord16
#
w
=
w
extendWord32
#
w
=
w
narrowWord8
#
w
=
w
narrowWord16
#
w
=
w
narrowWord32
#
w
=
w
#
endif
#
endif
#
endif
-- needed for casting words to float/double
import
Data.Binary.FloatCast
(
wordToFloat
,
wordToDouble
)
-- $lazyinterface
-- $lazyinterface
-- The lazy interface consumes a single lazy 'L.ByteString'. It's the easiest
-- The lazy interface consumes a single lazy 'L.ByteString'. It's the easiest
...
@@ -660,8 +674,8 @@ shiftl_w32 :: Word32 -> Int -> Word32
...
@@ -660,8 +674,8 @@ shiftl_w32 :: Word32 -> Int -> Word32
shiftl_w64
::
Word64
->
Int
->
Word64
shiftl_w64
::
Word64
->
Int
->
Word64
#
if
defined
(
__GLASGOW_HASKELL__
)
&&
!
defined
(
__HADDOCK__
)
#
if
defined
(
__GLASGOW_HASKELL__
)
&&
!
defined
(
__HADDOCK__
)
shiftl_w16
(
W16
#
w
)
(
I
#
i
)
=
W16
#
(
w
`
uncheckedShiftL
#
`
i
)
shiftl_w16
(
W16
#
w
)
(
I
#
i
)
=
W16
#
(
narrowWord16
#
((
extendWord16
#
w
)
`
uncheckedShiftL
#
`
i
)
)
shiftl_w32
(
W32
#
w
)
(
I
#
i
)
=
W32
#
(
w
`
uncheckedShiftL
#
`
i
)
shiftl_w32
(
W32
#
w
)
(
I
#
i
)
=
W32
#
(
narrowWord32
#
((
extendWord32
#
w
)
`
uncheckedShiftL
#
`
i
)
)
#
if
WORD_SIZE_IN_BITS
<
64
#
if
WORD_SIZE_IN_BITS
<
64
shiftl_w64
(
W64
#
w
)
(
I
#
i
)
=
W64
#
(
w
`
uncheckedShiftL64
#
`
i
)
shiftl_w64
(
W64
#
w
)
(
I
#
i
)
=
W64
#
(
w
`
uncheckedShiftL64
#
`
i
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment