quakeforge/libs/gamecode
Bill Currie 3c67e8f020 Fix the vector/quaternion scaling instructions.
It was pointed out by Blub\w (gmqcc) that OP_MUL_FV and friends were buggy
when the operands overlapped (eg, x = x.x * x) as the result would become
'x.x*x.x x.y*x.x*x.x x.z*x.x*x.x' (note the x.x squared for y and z). On
testing, sure enough the bug was present (and is a nice demonstration that
QF's VM does NOT have strict-aliasing bugs). As a very nice benefit: the
code produced by the fixes is actually faster than the broken version :).

The ruamoko code used for testing:
void (string fmt, ...) printf = #0;

vector foo (vector x)
{
    x = x * x.x;
    return x;
}

vector bar (vector x)
{
    x = x.x * x;
    return x;
}

int main ()
{
    vector x = '2 3 4';
    vector y = foo (x);
    vector z = bar (x);
    printf ("x=%v y=%v z=%v 2*x=%v\n", x, y, z, 2*x);
    return 0;
}
2013-01-17 10:23:02 +09:00
..
Makefile.am Link QFgamecode directly into QFruamoko. 2012-02-13 15:05:31 +09:00
pr_builtins.c Make hash tables more const correct. 2012-10-27 11:44:31 +09:00
pr_debug.c Change pointer_t to unsigned and clean up the mess. 2012-12-21 21:53:13 +09:00
pr_edict.c Dump a stack trace when running out of edicts. 2012-07-18 10:30:58 +09:00
pr_exec.c Fix the vector/quaternion scaling instructions. 2013-01-17 10:23:02 +09:00
pr_load.c Make hash tables more const correct. 2012-10-27 11:44:31 +09:00
pr_opcode.c Fix jumpb's operand types. 2012-12-05 22:20:55 +09:00
pr_parse.c Use g instead of e for the fp values. 2013-01-08 20:15:24 +09:00
pr_resolve.c Nuke the rcsid stuff. 2012-04-22 10:56:32 +09:00
pr_resource.c Make hash tables more const correct. 2012-10-27 11:44:31 +09:00
pr_strings.c Make hash tables more const correct. 2012-10-27 11:44:31 +09:00
pr_zone.c Nuke the rcsid stuff. 2012-04-22 10:56:32 +09:00