[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to erase memory fast?

At  3:33 PM 4/4/94 -0600, Alex Repenning wrote:
>Is there a way in MLC to clear a block of memory very fast? The function
>below erases an icon (32 x 32 x 4) in 1ms on a FX. That's quite slow. Is
>there no other, faster, way to erase a block of memory? .. or maybe some
>idea of how to make the function below a bit faster?
>(defun ERASE-ICON (Icon)
>  (declare (optimize (speed 3) (safety 0)))
>  (let ((Pixmap (rref Icon :Cicon.iconPMap.baseAddr)))
>    (dotimes (I (* (logand #x7FFF (rref Icon cicon.iconPMap.rowbytes))
>                 (rref Icon :cicon.iconPMap.bounds.bottom)))
>      (declare (fixnum I))
>      (%put-byte Pixmap 0 I))))

#_BlockMove will probably help. You can cons up, say, a 4K byte
pointer filled with 0's using %put-byte, then use one or more
#_BlockMove's to copy those 0's anywhere you want.