From 99b534f356a2e4f8e8c773be2e93f2939162df6d Mon Sep 17 00:00:00 2001 From: Alexander Ivanov Date: Mon, 26 Feb 2018 14:27:07 +0200 Subject: [PATCH] Use toInt --- rlp.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rlp.nim b/rlp.nim index 4fa6ee9..5eb166a 100644 --- a/rlp.nim +++ b/rlp.nim @@ -184,7 +184,7 @@ proc toInt*(self: Rlp, IntType: typedesc): IntType = raise newException(BadCastError, "") for i in payloadStart ..< (payloadStart + payloadSize): - result = cast[IntType](result shl 8) or cast[IntType](self.bytes[self.position + i]) + result = (result shl 8).toInt or (self.bytes[self.position + i]).toInt proc toString*(self: Rlp): string = if not isBlob(): @@ -306,6 +306,7 @@ proc decode*(bytes: openarray[byte]): RlpNode = bytesCopy = @bytes rlp = rlpFromBytes initBytesRange(bytesCopy) return rlp.toNodes + template decode*(bytes: BytesRange, T: typedesc): untyped = var rlp = rlpFromBytes bytes