ghc-cborg/307.patch

31 lines
898 B
Diff

From 7b94c5ac957cfa9d51815747d48dbec2d57a9aaa Mon Sep 17 00:00:00 2001
From: Jakub Janczak <jakub.janczak@scrive.com>
Date: Wed, 8 Feb 2023 21:33:24 +0100
Subject: [PATCH] Fix for machines with 64bit word and base >= 4.17
---
cborg/src/Codec/CBOR/Magic.hs | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/cborg/src/Codec/CBOR/Magic.hs b/cborg/src/Codec/CBOR/Magic.hs
index 1b497a2..cdeb455 100644
--- a/cborg/src/Codec/CBOR/Magic.hs
+++ b/cborg/src/Codec/CBOR/Magic.hs
@@ -257,11 +257,15 @@ grabWord64 (Ptr ip#) =
#endif
#if WORD_SIZE_IN_BITS == 64
+#if MIN_VERSION_base(4,17,0)
+-- case taken from Codec.CBOR.Decoding
+ w64 w# = W64# (wordToWord64# (toWord w#))
+#else
w64 w# = W64# (toWord w#)
+#endif
#else
w64 w# = W64# (wordToWord64# (toWord w#))
#endif
-
#endif
--------------------------------------------------------------------------------