Skip to content
This repository was archived by the owner on Jul 15, 2021. It is now read-only.

Commit

Permalink
Allow JIT optimization.
Browse files Browse the repository at this point in the history
Firefox speeds up a lot with this.
  • Loading branch information
waddlesplash committed Oct 10, 2013
1 parent ac9e0be commit f91ec89
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions sprites.js
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,13 @@ function memcpyU8(source, destination, readloc, writeloc, writelength/*, thing*/
if(readloc == null) readloc = 0;
if(writeloc == null) writeloc = 0;
if(writelength == null) writelength = max(0, min(source.length, destination.length));
while(writelength--)
// while(--writelength)
destination[writeloc++] = source[readloc++];

var lwritelength = writelength + 0; // Allow JIT integer optimization (Firefox needs this)
var lwriteloc = writeloc + 0;
var lreadloc = readloc + 0;
while(lwritelength--)
// while(--lwritelength)
destination[lwriteloc++] = source[lreadloc++];
}

// Somewhat cross-platform way to make a canvas' 2d context not smooth pixels
Expand Down

0 comments on commit f91ec89

Please sign in to comment.