base92> ( base92 -- seq )
Base92 conversions

Prev:>base92 ( seq -- base92 )


Vocabulary
base92

Inputs
base92a sequence


Outputs
seqa sequence


Word description
Decode from Base92 encoding.

Definition


:: base92> ( base92 -- seq )
base92 length :> len {
{ [ len 0 = ] [ B{ } clone ] }
{ [ len 1 = base92 first 126 = and ] [ B{ } clone ] }
{ [ len 2 < ] [ f ] }
[
0 :> b! 0 :> n! BV{ } clone :> accum len 2/ <iota> [
2 * dup 1 + [ base92 nth-unsafe base92>ch ] bi@
[ 91 * ] dip + b 13 shift bitor b! n 13 + n!
[ n 8 >= ] [
b n 8 - neg shift 255 bitand accum push
n 8 - n!
] while
] each len odd? [
len 1 - base92 nth-unsafe base92>ch b 6 shift
bitor b! n 6 + n!
[ n 8 >= ] [
b n 8 - neg shift 255 bitand accum push
n 8 - n!
] while
] when accum B{ } like
]
} cond ;