
18 May
2008
18 May
'08
12:05 p.m.
Bulat Ziganshin wrote:
Hello Andrew,
Sunday, May 18, 2008, 3:42:23 PM, you wrote:
How much do you want to bet that the C version just reads a chunk of data into RAM and then does a simple type-cast? (If I'm not very much mistaken, in C a type-cast is an O(0) operation.)
try unsafeCoerce# for that.
Yeah, I might end up being forced to do that. [Although obviously it'll break on big-endian architectures.]
or just use hGetArray to read directly into array of type you need
hGetArray :: Handle -> IOUArray Int Word8 -> Int -> IO Int (But yeah, I can coerce it afterwards.)