Skip to content

Commit 00042bd

Browse files
authored
Inline gput, gget for :+: (#227)
1 parent 053272c commit 00042bd

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/Data/Binary/Generic.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,15 @@ instance ( GSumPut a, GSumPut b
9393
| otherwise = sizeError "encode" size
9494
where
9595
size = unTagged (sumSize :: Tagged (a :+: b) Word64)
96+
{-# INLINE[0] gput #-}
9697

9798
instance ( GSumGet a, GSumGet b
9899
, SumSize a, SumSize b) => GBinaryGet (a :+: b) where
99100
gget | GETSUM(Word8) | GETSUM(Word16) | GETSUM(Word32) | GETSUM(Word64)
100101
| otherwise = sizeError "decode" size
101102
where
102103
size = unTagged (sumSize :: Tagged (a :+: b) Word64)
104+
{-# INLINE[0] gget #-}
103105

104106
sizeError :: Show size => String -> size -> error
105107
sizeError s size =
@@ -125,6 +127,7 @@ instance (GSumGet a, GSumGet b) => GSumGet (a :+: b) where
125127
where
126128
sizeL = size `shiftR` 1
127129
sizeR = size - sizeL
130+
{-# INLINE getSum #-}
128131

129132
instance (GSumPut a, GSumPut b) => GSumPut (a :+: b) where
130133
putSum !code !size s = case s of

0 commit comments

Comments
 (0)