From a025a7fcb04b8473773b550c7acf65ef6da4de7b Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Wed, 29 Jan 2020 15:51:19 -0800 Subject: [PATCH] hoon: added +repn --- pkg/arvo/lib/base64.hoon | 8 ++------ pkg/arvo/sys/hoon.hoon | 8 ++++++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pkg/arvo/lib/base64.hoon b/pkg/arvo/lib/base64.hoon index ec6516f6a4..dbbb5e419e 100644 --- a/pkg/arvo/lib/base64.hoon +++ b/pkg/arvo/lib/base64.hoon @@ -59,7 +59,7 @@ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' :: |^ |= bs=octs ^- cord - =/ [padding=@ blocks=(list word24)] + =+ ^- [padding=@ blocks=(list word24)] (octs-to-blocks bs) (crip (flop (unpad padding (encode-blocks blocks)))) :: @@ -127,10 +127,6 @@ =/ len (sub (mul 3 (div (add lat dif) 4)) dif) :+ ~ len %+ swp 3 - :: %+ base 64 - %+ roll - (weld dat (reap dif 0)) - |=([p=@ q=@] (add p (mul 64 q))) + (repn 6 (flop (weld dat (reap dif 0)))) -- -- - diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 797388b5d1..738c0af2c4 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -867,6 +867,14 @@ ?~ b 0 (add (lsh a c (end a 1 i.b)) $(c +(c), b t.b)) :: +++ repn + ~/ %repn + |= [bits=@ud x=(list @)] + =| c=@ud + |- ^- @ + ?~ x 0 + (add (lsh 0 (mul bits c) (end 0 bits i.x)) $(c +(c), x t.x)) +:: ++ rev :: reverses block order, accounting for leading zeroes ::