mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-21 11:11:37 +00:00
v6 modulo test
This commit is contained in:
parent
fa08e4afb7
commit
b90833d86f
3 changed files with 44 additions and 0 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -378,6 +378,10 @@ core
|
||||||
/tools/qfcc/source/qfcc
|
/tools/qfcc/source/qfcc
|
||||||
/tools/qfcc/source/qfprogs
|
/tools/qfcc/source/qfprogs
|
||||||
|
|
||||||
|
# /tools/qfcc/test/
|
||||||
|
/tools/qfcc/test/*.dat
|
||||||
|
/tools/qfcc/test/*.sym
|
||||||
|
|
||||||
# /tools/qflight/
|
# /tools/qflight/
|
||||||
|
|
||||||
# /tools/qflight/include/
|
# /tools/qflight/include/
|
||||||
|
|
2
tools/qfcc/test/.gdbinit
Normal file
2
tools/qfcc/test/.gdbinit
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
set args -o modulo.dat -Cv6only modulo.r
|
||||||
|
set height 0
|
38
tools/qfcc/test/modulo.r
Normal file
38
tools/qfcc/test/modulo.r
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#if 1
|
||||||
|
void (...) printf = #0;
|
||||||
|
float foo (float a, float b)
|
||||||
|
{
|
||||||
|
float c = a % b;
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
float bar (float a, float b)
|
||||||
|
{
|
||||||
|
float c;
|
||||||
|
b &= b;
|
||||||
|
a &= a;
|
||||||
|
c = a - ((a / b) & -1) * b;
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
float baz (float a, float b)
|
||||||
|
{
|
||||||
|
float c = (a + b) % (a - b);
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
#if 1
|
||||||
|
float main (void)
|
||||||
|
{
|
||||||
|
printf ("foo: 5 %% 3: %f\n", foo (5, 3));
|
||||||
|
printf ("bar: 5 %% 3: %f\n", bar (5, 3));
|
||||||
|
|
||||||
|
printf ("foo: -5 %% 3: %f\n", foo (-5, 3));
|
||||||
|
printf ("bar: -5 %% 3: %f\n", bar (-5, 3));
|
||||||
|
|
||||||
|
printf ("foo: 5 %% -3: %f\n", foo (5, -3));
|
||||||
|
printf ("bar: 5 %% -3: %f\n", bar (5, -3));
|
||||||
|
|
||||||
|
printf ("foo: -5 %% -3: %f\n", foo (-5, -3));
|
||||||
|
printf ("bar: -5 %% -3: %f\n", bar (-5, -3));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
Loading…
Reference in a new issue