length-to-code ( length -- code )


Vocabulary
compression.gzip.private

Inputs
lengthan object


Outputs
codean object


Definition


: length-to-code ( length -- code )
{
{ [ dup 11 < ] [ 254 + ] }
{
[ dup 19 < ]
[
[ 11 - 2 /i 265 + ]
[ 11 - 2 mod 1 <bits> >bit-array ] bi 2array
]
}
{
[ dup 35 < ]
[
[ 19 - 4 /i 269 + ]
[ 19 - 4 mod 2 <bits> >bit-array ] bi 2array
]
}
{
[ dup 67 < ]
[
[ 35 - 8 /i 273 + ]
[ 35 - 8 mod 3 <bits> >bit-array ] bi 2array
]
}
{
[ dup 131 < ]
[
[ 67 - 16 /i 277 + ]
[ 67 - 16 mod 4 <bits> >bit-array ] bi 2array
]
}
{
[ dup 258 < ]
[
[ 131 - 32 /i 281 + ]
[ 131 - 32 mod 5 <bits> >bit-array ] bi 2array
]
}
[ drop 285 ]
} cond ;