From 47c2864de3711f780694bc4cf955b730ee4985f9 Mon Sep 17 00:00:00 2001 From: Keith Lazuka Date: Sat, 26 Sep 2009 22:09:58 -0400 Subject: [PATCH] compression.lzw: additional refactoring --- basis/compression/lzw/lzw.factor | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/basis/compression/lzw/lzw.factor b/basis/compression/lzw/lzw.factor index 72de6f828c..e017636009 100644 --- a/basis/compression/lzw/lzw.factor +++ b/basis/compression/lzw/lzw.factor @@ -55,11 +55,10 @@ ERROR: not-in-table value ; GENERIC: code-space-full? ( lzw -- ? ) -M: tiff-lzw code-space-full? - [ table>> length ] [ code-size>> 2^ 1 - ] bi = ; +: size-and-limit ( lzw -- m n ) [ table>> length ] [ code-size>> 2^ ] bi ; -M: gif-lzw code-space-full? - [ table>> length ] [ code-size>> 2^ ] bi = ; +M: tiff-lzw code-space-full? size-and-limit 1 - = ; +M: gif-lzw code-space-full? size-and-limit = ; : maybe-increment-code-size ( lzw -- lzw ) dup code-space-full? [ [ 1 + ] change-code-size ] when ;