From bb793e0d96a09238aba05369ed40f941af7b9951 Mon Sep 17 00:00:00 2001 From: pilfer-pandex <47340789+pilfer-pandex@users.noreply.github.com> Date: Wed, 18 Aug 2021 00:37:57 -0400 Subject: [PATCH] king: fix actual perf problem: crufty LargeKey math in Packet.hs --- pkg/hs/urbit-king/lib/Urbit/Vere/Ames/Packet.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/hs/urbit-king/lib/Urbit/Vere/Ames/Packet.hs b/pkg/hs/urbit-king/lib/Urbit/Vere/Ames/Packet.hs index d2ddcdfc4..ea878d533 100644 --- a/pkg/hs/urbit-king/lib/Urbit/Vere/Ames/Packet.hs +++ b/pkg/hs/urbit-king/lib/Urbit/Vere/Ames/Packet.hs @@ -158,8 +158,8 @@ instance Serialize Packet where putByteString body where - putShipGetRank s@(Ship (LargeKey p q)) = case () of - _ | s < 2 ^ 16 -> (0, putWord16le $ fromIntegral s) -- lord - | s < 2 ^ 32 -> (1, putWord32le $ fromIntegral s) -- planet - | s < 2 ^ 64 -> (2, putWord64le $ fromIntegral s) -- moon - | otherwise -> (3, putWord64le p >> putWord64le q) -- comet + putShipGetRank (Ship (LargeKey p q)) = case q of + 0 | p < 2 ^ 16 -> (0, putWord16le $ fromIntegral p) -- lord + | p < 2 ^ 32 -> (1, putWord32le $ fromIntegral p) -- planet + | otherwise -> (2, putWord64le $ fromIntegral p) -- moon + _ -> (3, putWord64le p >> putWord64le q) -- comet