From f12a3249af84c903e5ae82dfb4761fe74d2aeac8 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Sat, 19 Sep 2015 02:23:40 +0200 Subject: [PATCH] rlp: add IntSize --- rlp/raw.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rlp/raw.go b/rlp/raw.go index 33aae6ee53..8589c9259b 100644 --- a/rlp/raw.go +++ b/rlp/raw.go @@ -34,6 +34,13 @@ func ListSize(contentSize uint64) uint64 { return uint64(headsize(contentSize)) + contentSize } +func IntSize(i uint64) uint64 { + if i < 128 { + return 1 + } + return 1 + uint64(intsize(i)) +} + // Split returns the content of first RLP value and any // bytes after the value as subslices of b. func Split(b []byte) (k Kind, content, rest []byte, err error) {