From 1d43e90969b585ba509db1a23dc1b82d6c8e947a Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Sun, 3 Sep 2023 10:07:45 -0700 Subject: [PATCH] leb128: simplify write-leb128 --- extra/leb128/leb128.factor | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extra/leb128/leb128.factor b/extra/leb128/leb128.factor index 6c1bddde6a..728c7c10c2 100644 --- a/extra/leb128/leb128.factor +++ b/extra/leb128/leb128.factor @@ -50,10 +50,10 @@ TYPED: uleb128> ( byte-array: byte-array -- n ) n [ [ -7 shift dup ] [ 0x7f bitand ] bi :> ( i b ) { - { [ i 0 = ] [ b 6 bit? not ] } - { [ i -1 = ] [ b 6 bit? ] } - [ f ] - } cond [ f b ] [ t b 0x80 bitor ] if quot call + { [ i 0 = ] [ b 6 bit? ] } + { [ i -1 = ] [ b 6 bit? not ] } + [ t ] + } cond b over [ 0x80 bitor ] when quot call ] loop drop ; inline HINTS: (write-leb128) { fixnum object } ; -- 2.34.1