Move Data Within a Bank

BlitzMax Forums/BlitzMax Module Tweaks/Move Data Within a Bank

SebHoll(Posted 2006) [#1]
Hi,

If anyone needs to move a block of memory in a bank to another position in the same bank then this function should do the trick.

In BlitzMax\mod\brl.mod\bank.mod\bank.bmx, add:
Rem
bbdoc: Move data within a bank
about:
#MoveBank moves @count bytes from @offset to @dst_offset.
End Rem
Function MoveBank( bank:TBank,offset,dst_offset,count )
	Assert..
	count>=0 And..
	offset>=0 And..
	offset>=0 And..
	offset+count<=bank.Size() And..
	dst_offset+count<=bank.Size() Else "Illegal range for MoveBank"
	MemMove( bank.Buf()+dst_offset,bank.Buf()+offset,count )
End Function
Then just recompile all the modules.


Seb