
26 Jan
2007
26 Jan
'07
7:08 p.m.
so I have this simple bit of code, which should be fast but seems to be being compiled to something very slow.
import Data.Word import Data.Bits
fhb :: Word -> Word fhb w = b1 .|. b2 where b2 = if 0xFFFF0000 .&. w /= 0 then 0x2 else 0 b1 = if 0xFF00FF00 .&. w /= 0 then 0x1 else 0
what it compiles to is something involving Integers, lots of coercions and other nasty stuff when it should consist of a couple of primitive operations. John -- John Meacham - ⑆repetae.net⑆john⑈