mirror of
https://github.com/urbit/shrub.git
synced 2024-12-24 11:24:21 +03:00
naive: replace +div/+mod calls with +dvr, rewrites +ud-to-ascii
This commit is contained in:
parent
aa29b61da5
commit
94b690cb74
@ -223,13 +223,8 @@
|
|||||||
=^ sig pos (take 3 65)
|
=^ sig pos (take 3 65)
|
||||||
=/ res=(unit [=tx pos=@ud]) parse-tx
|
=/ res=(unit [=tx pos=@ud]) parse-tx
|
||||||
?~ res ~
|
?~ res ~
|
||||||
=/ [len=@ rem=@]
|
=/ [len=@ rem=@] (dvr (sub pos.u.res pos) 8)
|
||||||
:: XX (dvr (sub pos.u.res pos) 8)
|
?> =(0 rem)
|
||||||
=/ dif (sub pos.u.res pos)
|
|
||||||
[(div dif 8) (mod dif 8)]
|
|
||||||
?. =(0 rem)
|
|
||||||
:: XX parse fail, produce ~ ?
|
|
||||||
!!
|
|
||||||
:- ~ :_ pos.u.res
|
:- ~ :_ pos.u.res
|
||||||
[sig [len (cut 0 [pos pos.u.res] batch)] tx.u.res]
|
[sig [len (cut 0 [pos pos.u.res] batch)] tx.u.res]
|
||||||
::
|
::
|
||||||
@ -387,10 +382,12 @@
|
|||||||
::
|
::
|
||||||
++ ud-to-ascii
|
++ ud-to-ascii
|
||||||
|= n=@ud
|
|= n=@ud
|
||||||
^- @t
|
?~ n '0'
|
||||||
?~ n
|
=| l=(list @)
|
||||||
*@t
|
|- ^- @t
|
||||||
(cat 3 $(n (div n 10)) (add '0' (mod n 10)))
|
?~ n (rep 3 l)
|
||||||
|
=+ (dvr n 10)
|
||||||
|
$(n p, l [(add '0' q) l])
|
||||||
::
|
::
|
||||||
++ ship-rank
|
++ ship-rank
|
||||||
|= =ship
|
|= =ship
|
||||||
|
Loading…
Reference in New Issue
Block a user