Skip to content

Commit

Permalink
Updated normalize function, uses sqrt. Old normalize is a
Browse files Browse the repository at this point in the history
fast version.  Added more cases to unit test for vector.
So far found nothing wrong with the vec4 results..

Some minor accuracy isses with sqrt, but that is at the
0.00001 level..  should not cause much if any error..
  • Loading branch information
Byron Heads committed Dec 11, 2011
1 parent 9594bb8 commit e17411c
Show file tree
Hide file tree
Showing 3 changed files with 213 additions and 127 deletions.
4 changes: 2 additions & 2 deletions rtrt/modules/vec4.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ struct vec4
"shufps $0xb1, %%xmm0, %%xmm0 \n\t" // b1 1011 0001 (2 3 0 1) xmm1 (zw, zw, xy, xy)
"addps %%xmm1, %%xmm0 \n\t" // add xmm1 to xmm0 (xyzw, xyzw, xyzw, xyzw)
"sqrtps %%xmm0, %%xmm0 \n\t" // take the sqrt of xmm0
"divps %%xmm2, %%xmm0 \n\t" // divide
"movaps %%xmm0, %0 \n\t"
"divps %%xmm0, %%xmm2 \n\t" // divide
"movaps %%xmm2, %0 \n\t"
: "=m"(*this)
: "m"(*this)
: "xmm0", "xmm1", "xmm2"
Expand Down
4 changes: 2 additions & 2 deletions rtrt_test/rtrt_test.pro.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by Qt Creator 2.3.1, 2011-12-10T21:21:17. -->
<!-- Written by Qt Creator 2.3.1, 2011-12-10T21:44:44. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
Expand Down Expand Up @@ -87,7 +87,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Target.DesktopTarget</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
Expand Down
Loading

0 comments on commit e17411c

Please sign in to comment.