forked from github/server
validation code for FASTROW optimization
This commit is contained in:
parent
373e869931
commit
2576f781d4
|
@ -479,9 +479,7 @@ get_unitrow(const fighter * af, const side * vs)
|
||||||
} else {
|
} else {
|
||||||
#ifdef FASTROW
|
#ifdef FASTROW
|
||||||
battle * b = vs->battle;
|
battle * b = vs->battle;
|
||||||
if (row==b->rowcache.row && b->alive==b->rowcache.alive && af->side==b->rowcache.as && vs==b->rowcache.vs) {
|
if (row!=b->rowcache.row || b->alive!=b->rowcache.alive || af->side!=b->rowcache.as || vs!=b->rowcache.vs) {
|
||||||
return b->rowcache.result;
|
|
||||||
} else {
|
|
||||||
b->rowcache.alive = b->alive;
|
b->rowcache.alive = b->alive;
|
||||||
b->rowcache.as = af->side;
|
b->rowcache.as = af->side;
|
||||||
b->rowcache.vs = vs;
|
b->rowcache.vs = vs;
|
||||||
|
@ -489,6 +487,12 @@ get_unitrow(const fighter * af, const side * vs)
|
||||||
b->rowcache.result = get_row(af->side, row, vs);
|
b->rowcache.result = get_row(af->side, row, vs);
|
||||||
return b->rowcache.result;
|
return b->rowcache.result;
|
||||||
}
|
}
|
||||||
|
#if 1 /* validation code */
|
||||||
|
{
|
||||||
|
int i = get_row(af->side, row, vs);
|
||||||
|
assert(i==b->rowcache.result);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return b->rowcache.result;
|
return b->rowcache.result;
|
||||||
#else
|
#else
|
||||||
return get_row(af->side, row, vs);
|
return get_row(af->side, row, vs);
|
||||||
|
|
|
@ -70,7 +70,7 @@ extern "C" {
|
||||||
#ifdef SMALL_BATTLE_MESSAGES
|
#ifdef SMALL_BATTLE_MESSAGES
|
||||||
boolean small;
|
boolean small;
|
||||||
#endif
|
#endif
|
||||||
#undef FASTROW
|
#define FASTROW
|
||||||
#ifdef FASTROW
|
#ifdef FASTROW
|
||||||
struct {
|
struct {
|
||||||
const struct side * as;
|
const struct side * as;
|
||||||
|
@ -80,7 +80,7 @@ extern "C" {
|
||||||
int result;
|
int result;
|
||||||
} rowcache;
|
} rowcache;
|
||||||
#endif
|
#endif
|
||||||
#undef FASTCOUNT
|
#define FASTCOUNT
|
||||||
#ifdef FASTCOUNT
|
#ifdef FASTCOUNT
|
||||||
struct {
|
struct {
|
||||||
struct side * side;
|
struct side * side;
|
||||||
|
|
Loading…
Reference in New Issue