@@ -386,7 +386,7 @@ instance Encode RunBloomFilterAlloc where
386386 encode (RunAllocFixed bits) =
387387 encodeListLen 2
388388 <> encodeWord 0
389- <> encodeIntOrDouble bits
389+ <> encodeDouble bits
390390 encode (RunAllocRequestFPR fpr) =
391391 encodeListLen 2
392392 <> encodeWord 1
@@ -397,7 +397,7 @@ instance DecodeVersioned RunBloomFilterAlloc where
397397 n <- decodeListLen
398398 tag <- decodeWord
399399 case (n, tag) of
400- (2 , 0 ) -> RunAllocFixed <$> decodeIntOrDouble
400+ (2 , 0 ) -> RunAllocFixed <$> decodeDouble
401401 (2 , 1 ) -> RunAllocRequestFPR <$> decodeDouble
402402 _ -> fail (" [RunBloomFilterAlloc] Unexpected combination of list length and tag: " <> show (n, tag))
403403
@@ -407,7 +407,7 @@ instance Encode BloomFilterAlloc where
407407 encode (AllocFixed x) =
408408 encodeListLen 2
409409 <> encodeWord 0
410- <> encodeIntOrDouble x
410+ <> encodeDouble x
411411 encode (AllocRequestFPR x) =
412412 encodeListLen 2
413413 <> encodeWord 1
@@ -418,28 +418,10 @@ instance DecodeVersioned BloomFilterAlloc where
418418 n <- decodeListLen
419419 tag <- decodeWord
420420 case (n, tag) of
421- (2 , 0 ) -> AllocFixed <$> decodeIntOrDouble
421+ (2 , 0 ) -> AllocFixed <$> decodeDouble
422422 (2 , 1 ) -> AllocRequestFPR <$> decodeDouble
423423 _ -> fail (" [BloomFilterAlloc] Unexpected combination of list length and tag: " <> show (n, tag))
424424
425- -- Avoid a format change when the value is an integer: int or double encoding.
426- encodeIntOrDouble :: Double -> Encoding
427- encodeIntOrDouble x
428- | let x' = floor x
429- , x == fromIntegral x' = encodeInt x'
430- | otherwise = encodeDouble x
431-
432- decodeIntOrDouble :: Decoder s Double
433- decodeIntOrDouble = do
434- tok <- peekTokenType
435- if isTokInt tok
436- then fromIntegral <$> decodeInt
437- else decodeDouble
438- where
439- isTokInt TypeUInt = True
440- isTokInt TypeNInt = True
441- isTokInt _ = False
442-
443425-- FencePointerIndexType
444426
445427instance Encode FencePointerIndexType where
0 commit comments