mirror of
https://github.com/urbit/shrub.git
synced 2024-12-20 09:21:42 +03:00
king: fix actual perf problem: crufty LargeKey math in Packet.hs
This commit is contained in:
parent
c05b5ecdc0
commit
bb793e0d96
@ -158,8 +158,8 @@ instance Serialize Packet where
|
|||||||
putByteString body
|
putByteString body
|
||||||
|
|
||||||
where
|
where
|
||||||
putShipGetRank s@(Ship (LargeKey p q)) = case () of
|
putShipGetRank (Ship (LargeKey p q)) = case q of
|
||||||
_ | s < 2 ^ 16 -> (0, putWord16le $ fromIntegral s) -- lord
|
0 | p < 2 ^ 16 -> (0, putWord16le $ fromIntegral p) -- lord
|
||||||
| s < 2 ^ 32 -> (1, putWord32le $ fromIntegral s) -- planet
|
| p < 2 ^ 32 -> (1, putWord32le $ fromIntegral p) -- planet
|
||||||
| s < 2 ^ 64 -> (2, putWord64le $ fromIntegral s) -- moon
|
| otherwise -> (2, putWord64le $ fromIntegral p) -- moon
|
||||||
| otherwise -> (3, putWord64le p >> putWord64le q) -- comet
|
_ -> (3, putWord64le p >> putWord64le q) -- comet
|
||||||
|
Loading…
Reference in New Issue
Block a user