
4 Feb
2007
4 Feb
'07
8:19 a.m.
On 2/4/07, Dominic Steinitz
pad causes a stack overflow and pad1 uses up about 6m of heap.
pad = pad' 0 where pad' l [] = [0x80] ++ ps where pl = (64-(l+9)) `mod` 64 ps = replicate pl 0x00 pad' l (x:xs) = x : pad' (l+1) xs
pad = pad' 0 where pad' l [] = [0x80] ++ ps where pl = (64-(l+9)) `mod` 64 ps = replicate pl 0x00 pad' l (x:xs) = x : (pad' $! l+1) xs -- otherwise (l+1) it will be deferred until replicate -- Tolik