[gamecode] Switch to using type parameter op macros

I wish I'd done it this way years ago (but maybe gcc 2.95 couldn't hack
the casts, I do know there were aliasing problems in the past). Anyway,
this makes operand access much more consistent for variable sized
operands (eg float vs double vs vec4), and is a big part of the new
instruction set implementation.
This commit is contained in:
Bill Currie 2022-01-02 20:46:32 +09:00
parent 7b0eceda32
commit bc0a09f452
4 changed files with 266 additions and 275 deletions

View file

@ -289,7 +289,7 @@ void ED_Free (progs_t *pr, edict_t *ed);
edict_t *ED_EdictNum(progs_t *pr, pr_int_t n) __attribute__((pure)); edict_t *ED_EdictNum(progs_t *pr, pr_int_t n) __attribute__((pure));
pr_int_t ED_NumForEdict(progs_t *pr, edict_t *e) __attribute__((pure)); pr_int_t ED_NumForEdict(progs_t *pr, edict_t *e) __attribute__((pure));
void ED_Count (progs_t *pr); void ED_Count (progs_t *pr);
qboolean PR_EdictValid (progs_t *pr, pr_int_t e) __attribute__((pure)); qboolean PR_EdictValid (progs_t *pr, pr_uint_t e) __attribute__((pure));
// pr_debug.c // pr_debug.c
void ED_Print (progs_t *pr, edict_t *ed, const char *fieldname); void ED_Print (progs_t *pr, edict_t *ed, const char *fieldname);
@ -1900,7 +1900,7 @@ struct progs_s {
void (*free_edict) (progs_t *pr, edict_t *ent); void (*free_edict) (progs_t *pr, edict_t *ent);
pr_type_t *pr_edict_area; pr_type_t *pr_edict_area;
int pr_edict_size; ///< # of pr_type_t slots int pr_edict_size; ///< # of pr_type_t slots
int pr_edict_area_size; ///< for bounds checking, starts at 0 pr_uint_t pr_edict_area_size; ///< for bounds checking, starts at 0
func_t edict_parse; func_t edict_parse;
///@} ///@}

View file

@ -1536,7 +1536,7 @@ PR_PrintStatement (progs_t *pr, dstatement_t *s, int contents)
const char *str; const char *str;
char mode = fmt[1], opchar = fmt[2]; char mode = fmt[1], opchar = fmt[2];
unsigned parm_ind = 0; unsigned parm_ind = 0;
pr_int_t opval; pr_uint_t opval;
qfot_type_t *optype = &res->void_type; qfot_type_t *optype = &res->void_type;
func_t func; func_t func;

View file

@ -241,12 +241,12 @@ ED_NumForEdict (progs_t *pr, edict_t *e)
} }
qboolean qboolean
PR_EdictValid (progs_t *pr, pr_int_t e) PR_EdictValid (progs_t *pr, pr_uint_t e)
{ {
if (!pr->num_edicts) { if (!pr->num_edicts) {
return false; return false;
} }
if (e < 0 || e >= pr->pr_edict_area_size) if (e >= pr->pr_edict_area_size)
return false; return false;
if (e % pr->pr_edict_size) if (e % pr->pr_edict_size)
return false; return false;

File diff suppressed because it is too large Load diff