reorganized sqr storage for better cache usage

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4113 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lee Salzman
2009-01-04 18:42:09 +00:00
parent 2f27cba52c
commit 4d6ffecf29
8 changed files with 51 additions and 50 deletions
+2 -2
View File
@@ -316,14 +316,14 @@ block *blockcopy(const block &s)
block *b = (block *)new uchar[sizeof(block)+s.xs*s.ys*sizeof(sqr)];
*b = s;
sqr *q = (sqr *)(b+1);
for(int x = s.x; x<s.xs+s.x; x++) for(int y = s.y; y<s.ys+s.y; y++) *q++ = *S(x,y);
for(int y = s.y; y<s.ys+s.y; y++) for(int x = s.x; x<s.xs+s.x; x++) *q++ = *S(x,y);
return b;
}
void blockpaste(const block &b)
{
const sqr *q = (const sqr *)((&b)+1);
for(int x = b.x; x<b.xs+b.x; x++) for(int y = b.y; y<b.ys+b.y; y++) *S(x,y) = *q++;
for(int y = b.y; y<b.ys+b.y; y++) for(int x = b.x; x<b.xs+b.x; x++) *S(x,y) = *q++;
remipmore(b);
}