diff options
author | sof <unknown> | 2001-12-27 11:26:03 +0000 |
---|---|---|
committer | sof <unknown> | 2001-12-27 11:26:03 +0000 |
commit | 14b9c05ff17f318b64b112040621e1513bd1def3 (patch) | |
tree | 1d082759ec93fb89f84b63f49a3bfe3cfd9059e2 | |
parent | 215280e9692c0b2063b83342b0e900c8028a8eb7 (diff) | |
download | haskell-14b9c05ff17f318b64b112040621e1513bd1def3.tar.gz |
[project @ 2001-12-27 11:26:03 by sof]
Added & exported low-level memcpy() wrappers - possible to offset both
src and dest.
-rw-r--r-- | ghc/lib/std/PrelIO.hs | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/ghc/lib/std/PrelIO.hs b/ghc/lib/std/PrelIO.hs index 335d36111d..39132b416f 100644 --- a/ghc/lib/std/PrelIO.hs +++ b/ghc/lib/std/PrelIO.hs @@ -3,7 +3,7 @@ #undef DEBUG_DUMP -- ----------------------------------------------------------------------------- --- $Id: PrelIO.hs,v 1.6 2001/12/27 09:28:11 sof Exp $ +-- $Id: PrelIO.hs,v 1.7 2001/12/27 11:26:03 sof Exp $ -- -- (c) The University of Glasgow, 1992-2001 -- @@ -21,6 +21,12 @@ module PrelIO ( hPutStrLn, hPrint, commitBuffer', -- hack, see below hGetcBuffered, -- needed by ghc/compiler/utils/StringBuffer.lhs + + -- helpers + memcpy_ba_ba, + memcpy_ba_ptr, + memcpy_ptr_ba, + memcpy_ptr_ptr ) where import PrelBase @@ -593,7 +599,7 @@ commitBuffer' hdl raw sz@(I# _) count@(I# _) flush release -- not flushing, and there's enough room in the buffer: -- just copy the data in and update bufWPtr. - then do memcpy_off old_raw w raw (fromIntegral count) + then do memcpy_ba_ba old_raw w raw 0 (fromIntegral count) writeIORef ref old_buf{ bufWPtr = w + count } return (newEmptyBuffer raw WriteBuffer sz) @@ -638,7 +644,16 @@ commitBuffer' hdl raw sz@(I# _) count@(I# _) flush release foreign import "prel_PrelIO_memcpy" unsafe - memcpy_off :: RawBuffer -> Int -> RawBuffer -> CSize -> IO (Ptr ()) + memcpy_ba_ba :: RawBuffer -> Int -> RawBuffer -> Int -> CSize -> IO (Ptr ()) + +foreign import "prel_PrelIO_memcpy" unsafe + memcpy_ba_ptr :: RawBuffer -> Int -> Ptr a -> Int -> CSize -> IO (Ptr ()) + +foreign import "prel_PrelIO_memcpy" unsafe + memcpy_ptr_ba :: Ptr a -> Int -> RawBuffer -> Int -> CSize -> IO (Ptr ()) + +foreign import "prel_PrelIO_memcpy" unsafe + memcpy_ptr_ptr :: Ptr a -> Int -> Ptr a -> Int -> CSize -> IO (Ptr ()) -- --------------------------------------------------------------------------- -- hPutStrLn |