diff options
author | blazy <blazy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2006-10-20 12:37:13 +0000 |
---|---|---|
committer | blazy <blazy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2006-10-20 12:37:13 +0000 |
commit | ca0c62265eb8cdd5fb0d8a8b34ee77baf3de987e (patch) | |
tree | 50a139db8e2ac51c6ff41f3790ff72aa417ed3be /test/ccured_olden/voronoi/vector.c | |
parent | 43668d9109b1f36329646fd07324d435be6f0050 (diff) | |
download | compcert-ca0c62265eb8cdd5fb0d8a8b34ee77baf3de987e.tar.gz compcert-ca0c62265eb8cdd5fb0d8a8b34ee77baf3de987e.zip |
Ajout du banc de tests de CCured (Olden benchmark suite, cf.
CCured: type-safe retrofitting of legacy code, G.Necula et al.)
rapportCompcert_all.txt liste les erreurs produites par ccomp.
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@121 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'test/ccured_olden/voronoi/vector.c')
-rw-r--r-- | test/ccured_olden/voronoi/vector.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/test/ccured_olden/voronoi/vector.c b/test/ccured_olden/voronoi/vector.c new file mode 100644 index 00000000..1a288d7b --- /dev/null +++ b/test/ccured_olden/voronoi/vector.c @@ -0,0 +1,80 @@ +/* For copyright information, see olden_v1.0/COPYRIGHT */ + +#include "defines.h" + +/****************************************************************/ +/* Vector Routines. */ +/* From CMU vision library. */ +/* They are used only for the VD, not the DT. */ +/* They are slow because of large call-by-value parameters.*/ +/****************************************************************/ + +/* V2_cprod: forms triple scalar product of [u,v,k], where k = u cross v */ +/* (returns the magnitude of u cross v in space)*/ + +double V2_cprod(u,v) + struct VEC2 u,v; +{ + return(u.x * v.y - u.y * v.x); +} + + +/* V2_dot: vector dot product */ + +double V2_dot(u,v) +struct VEC2 u,v; +{ + return(u.x * v.x + u.y * v.y); +} + +/* V2_times: multiply a vector by a scalar */ + +struct VEC2 V2_times(c,v) + double c; + struct VEC2 v; +{ + struct VEC2 ans; + ans.x = c * v.x; + ans.y = c * v.y; + return(ans); +} + +/* V2_sum, V2_sub: Vector addition and subtraction */ + +struct VEC2 V2_sum(u,v) + struct VEC2 u,v; +{ + struct VEC2 ans; + + ans.x = u.x + v.x; + ans.y = u.y + v.y; + return(ans); +} + +struct VEC2 V2_sub(u,v) + struct VEC2 u,v; +{ + struct VEC2 ans; + ans.x = u.x - v.x; + ans.y = u.y - v.y; + return(ans); +} + +/* V2_magn: magnitude of vector */ + +double V2_magn(u) + struct VEC2 u; +{ + return(sqrt(u.x*u.x+u.y*u.y)); +} + +/* returns k X v (cross product). this is a vector perpendicular to v */ + +struct VEC2 V2_cross(v) + struct VEC2 v; +{ + struct VEC2 ans; + ans.x = v.y; + ans.y = -v.x; + return(ans); +} |