mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 07:11:41 +00:00
Allow tests for full overlap of defs.
Not actually used yet, but I imagine I'll want it.
This commit is contained in:
parent
821081c9c8
commit
2dc60d4f9a
2 changed files with 9 additions and 5 deletions
|
@ -251,7 +251,8 @@ void initialize_def (struct symbol_s *sym, struct type_s *type,
|
|||
|
||||
\param d1 The first def to check. May be an alias def.
|
||||
\param d2 The second def to check. May be an alias def.
|
||||
\return 1 if the defs overlap, 0 otherwise.
|
||||
\return 1 if the defs overlap, 2 if \a d1 fully overlaps \a d2,
|
||||
otherwise 0.
|
||||
*/
|
||||
int def_overlap (def_t *d1, def_t *d2);
|
||||
|
||||
|
@ -293,8 +294,9 @@ int def_size (def_t *def);
|
|||
function will return.
|
||||
|
||||
\param def The def representing the alias cluster to visit.
|
||||
\param overlap If true, then only defs that overlap \a def will be
|
||||
visited.
|
||||
\param overlap If non-zero, then only defs that overlap \a def will
|
||||
be visited. If 2, then the given def must fully overlap
|
||||
the visited def.
|
||||
\param visit The function to call when visiting a def. The first
|
||||
parameter is the def being visited, and the second
|
||||
parameter is \a data passed on. If non-zero is returned,
|
||||
|
|
|
@ -615,8 +615,10 @@ def_overlap (def_t *d1, def_t *d2)
|
|||
offs2 += d2->alias->offset;
|
||||
size2 = type_size (d2->type);
|
||||
|
||||
if (offs1 <= offs2 && offs1 + size1 >= offs2 + size2)
|
||||
return 2; // d1 fully overlaps d2
|
||||
if (offs1 < offs2 + size2 && offs2 < offs1 + size1)
|
||||
return 1;
|
||||
return 1; // d1 and d2 at least partially overlap
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -652,7 +654,7 @@ def_visit_all (def_t *def, int overlap,
|
|||
for (def = def->alias_defs; def; def = def->next) {
|
||||
if (def == start_def)
|
||||
continue;
|
||||
if (overlap && !def_overlap (def, start_def))
|
||||
if (overlap && def_overlap (def, start_def) < overlap)
|
||||
continue;
|
||||
if ((ret = visit (def, data)))
|
||||
return ret;
|
||||
|
|
Loading…
Reference in a new issue