From 11b70e1d798dc07db7edd87327eff42fcdb494e3 Mon Sep 17 00:00:00 2001 From: chrsm Date: Wed, 28 Dec 2022 20:16:08 -0800 Subject: [PATCH] decode: allow int64 or bigint --- rpa.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/rpa.go b/rpa.go index db68a26..8d4eece 100644 --- a/rpa.go +++ b/rpa.go @@ -205,7 +205,21 @@ func Decode(r *os.File) (*RPA, error) { // pickle.Tuple is an []interface{} in a fancy hat val := (v.([]interface{})[0]).(pickle.Tuple) - ofs, sz := val[0].(*big.Int).Int64(), val[1].(*big.Int).Int64() + var ofs, sz int64 + + switch nv := val[0].(type) { + case *big.Int: + ofs = nv.Int64() + case int64: + ofs = nv + } + + switch nv := val[1].(type) { + case *big.Int: + sz = nv.Int64() + case int64: + sz = nv + } pak.Indexes = append(pak.Indexes, Index{ Name: k.(string),