Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* writeIntPattern() aka memset() */
- public inline function writeIntPattern(_pattern:Int,_offset:Int,_length:Int):Void {
- /* write our Int pattern twice */
- write32(_pattern,_offset);
- write32(_pattern,_offset+4);
- /* get the float version of our pattern */
- var value = read64(_offset);
- /* we decide how far to write our pattern with write64, max 600 bytes */
- var position = IntMath.min(600,_length);
- /* the loop is backwards and ends within the last 8 bytes because they are already written */
- while((position-=8)>0) {write64(value,_offset+position);}
- var distance = 600;
- var copylength = 600;
- /* now that we have 600 bytes written, we start using writeBytes to mass copy the bytes */
- while(_length>distance) {
- /* AlchemyManager sold seperately */
- platform.flash.utils.AlchemyManager.bytearray.position = address+distance;
- platform.flash.utils.AlchemyManager.bytearray.writeBytes(platform.flash.utils.AlchemyManager.bytearray,address,copylength);
- /* the next mass copy will be twice as big, eg 600->1200->2400->4800->etc */
- distance*=2;
- copylength*=2;
- /* in case the next mass copy will spill over the length, we need to clamp the copylength here */
- copylength=IntMath.min(_length-copylength,copylength);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement