I can't get inline to work for this simple function.
I thought I understood [Inline] but my app says otherwise.
I've been using [Inline] with great success for a few months now; however, this quick snippet of code won't [Inline] properly. I know this because I've ran numerous tests with the function looped 100,000 times and I'll get around 400ms with [Inline] and 400ms without [Inline].
I could just be really sleepy and frustrated, but I thought I'd try and learn so that I wouldn't make the same mistake again. So here are the guts of the function in question:
var shared:int = 0;
var length:int = goodRegions[index].length;
for ( var i:int = 0; i < length; ++i ) {
rect = goodRegions[index];
mRect.x = rect.x + masterX;
mRect.width = rect.width;
if ( mRect.x + mRect.width > sRect.x ) {
shared = i;
break;
}
}
for ( var i:int = shared; i < length; ++i ) {
rect = goodRegions[index];
mRect.x = rect.x + masterX;
mRect.y = rect.y + masterY;
mRect.width = rect.width;
mRect.height = rect.height;
if ( sRect.x + sRect.width < mRect.x ) { break; }
}
There are outside variables I didn't include because they are passed through the function parameters.
I would greatly any help I can get understanding what I'm doing wrong.