mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 04:21:51 +00:00
[qfcc] Improve offset_cast's zero detection
I'd caught 0 single components, but I'd missed 0 vector components. This shaves 4 instructions off the motor-point test.
This commit is contained in:
parent
068f685fde
commit
ca01ab2a27
1 changed files with 7 additions and 1 deletions
|
@ -167,7 +167,13 @@ offset_cast (type_t *type, expr_t *expr, int offset)
|
|||
if (type_width (get_type (ext.src)) == type_width (type)) {
|
||||
return alias_expr (type, ext.src, 0);
|
||||
}
|
||||
if (offset >= type_width (get_type (ext.src))) {
|
||||
bool rev = ext.reverse;
|
||||
int cwidth = type_width (type);
|
||||
int dwidth = type_width (ext.type);
|
||||
int swidth = type_width (get_type (ext.src));
|
||||
|
||||
if ((!rev && offset >= swidth)
|
||||
|| (rev && offset + cwidth <= dwidth - swidth)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue