Hello Tom,
Thursday, May 29, 2008, 8:21:25 PM, you wrote:
> Are there any low-level array types (MutableByteArray#, for example)
> that support a memcpy-like function
yes, MBA# allows to use memcpy. you can find examples of its
usage right in the array package, for example:
thawSTUArray :: Ix i => UArray i e -> ST s (STUArray s i e)
thawSTUArray (UArray l u arr#) = ST $ \s1# ->
case sizeofByteArray# arr# of { n# ->
case newByteArray# n# s1# of { (# s2#, marr# #) ->
case unsafeCoerce# memcpy marr# arr# n# s2# of { (# s3#, () #) ->
(# s3#, STUArray l u marr# #) }}}
foreign import ccall unsafe "memcpy"
memcpy :: MutableByteArray# RealWorld -> ByteArray# -> Int# -> IO ()
i can give you further explanations if required
--
Best regards,
Bulat mailto:[EMAIL PROTECTED]
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe