[Haskell-cafe] Understanding allocation behavior

Bulat Ziganshin bulat.ziganshin at gmail.com
Sun Apr 9 06:31:09 EDT 2006


Hello Robert,

Sunday, April 9, 2006, 2:54:58 AM, you wrote:

> findMinIndex :: Word -> Int
> findMaxIndex :: Word -> Int

on the other side, these procedures can use the same divide-to-bytes
technique as `size`

findMinIndex 0 = undefined
findMinIndex n = case (n `shiftR` 8) of
                   0 -> minIndexInByte ! (n .&. 255)
                   b -> 8 + findMinIndex b

something like this should work


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list