diff --git a/rlp.nim b/rlp.nim index 499b6b2..54b627b 100644 --- a/rlp.nim +++ b/rlp.nim @@ -293,6 +293,10 @@ proc readImpl(rlp: var Rlp, T: typedesc[enum]): T = result = type(result)(rlp.toInt(int)) rlp.skipElem +proc readImpl(rlp: var Rlp, T: typedesc[bool]): T = + result = rlp.toInt(int) != 0 + rlp.skipElem + proc readImpl[R, E](rlp: var Rlp, T: type array[R, E]): T = mixin read diff --git a/rlp/writer.nim b/rlp/writer.nim index a7cd2ed..9935dc2 100644 --- a/rlp/writer.nim +++ b/rlp/writer.nim @@ -191,6 +191,9 @@ template appendImpl(self; i: Integer) = template appendImpl(self; e: enum) = appendImpl(self, int(e)) +template appendImpl(self; b: bool) = + appendImpl(self, int(b)) + proc appendImpl[T](self; listOrBlob: openarray[T]) = mixin append