From c84b0d9ca80faab64eb4ecafb015f0f77e153dae Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Sat, 30 Jun 2018 23:22:15 -0400 Subject: [PATCH] tail-call optimizes +ctra, +ctrb, and +ctrc in |aes --- sys/zuse.hoon | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/sys/zuse.hoon b/sys/zuse.hoon index 58e61ab73..2c87e7cba 100644 --- a/sys/zuse.hoon +++ b/sys/zuse.hoon @@ -1967,11 +1967,14 @@ %+ mix txt %^ rsh 3 (sub (mul 16 blocks) len) %+ rep 7 - %- flop - |- ^- (list @ux) - ?: =(blocks 0) ~ - :- (encrypt ctr) - $(ctr (inc mod ctr), blocks (dec blocks)) + =| seed=(list @ux) + |- ^+ seed + ?: =(blocks 0) seed + %= $ + seed [(encrypt ctr) seed] + ctr (inc mod ctr) + blocks (dec blocks) + == :: :: ++de:ctra:aes:crypto ++ de :: decrypt en @@ -1991,11 +1994,14 @@ %+ mix txt %^ rsh 3 (sub (mul 16 blocks) len) %+ rep 7 - %- flop - |- ^- (list @ux) - ?: =(blocks 0) ~ - :- (encrypt ctr) - $(ctr (inc mod ctr), blocks (dec blocks)) + =| seed=(list @ux) + |- ^+ seed + ?: =(blocks 0) seed + %= $ + seed [(encrypt ctr) seed] + ctr (inc mod ctr) + blocks (dec blocks) + == :: :: ++de:ctrb:aes:crypto ++ de :: decrypt en @@ -2015,11 +2021,14 @@ %+ mix txt %^ rsh 3 (sub (mul 16 blocks) len) %+ rep 7 - %- flop - |- ^- (list @ux) - ?: =(blocks 0) ~ - :- (encrypt ctr) - $(ctr (inc mod ctr), blocks (dec blocks)) + =| seed=(list @ux) + |- ^+ seed + ?: =(blocks 0) seed + %= $ + seed [(encrypt ctr) seed] + ctr (inc mod ctr) + blocks (dec blocks) + == :: :: ++de:ctrc:aes:crypto ++ de :: decrypt en