mirror of
https://github.com/urbit/shrub.git
synced 2024-11-27 18:34:48 +03:00
hoon: added +repn
This commit is contained in:
parent
deb3d26d3f
commit
a025a7fcb0
@ -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))))
|
||||
--
|
||||
--
|
||||
|
||||
|
@ -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
|
||||
::
|
||||
|
Loading…
Reference in New Issue
Block a user