Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

implemented normalize()

  • Loading branch information...
commit ef76907122810245929ed5ee3d791c71e12924e4 1 parent 2117aa9
blasty blasty authored
Showing with 19 additions and 1 deletion.
  1. +19 −1 intro.s
20 intro.s
View
@@ -115,9 +115,27 @@ length3:
vsqrt.f32 s0, s0
bx lr
-#
+# args: r0=*x, r1=*y, r2=*z
normalize:
+ vldr.f32 s0, [r0]
+ vldr.f32 s1, [r0,#4]
+ vldr.f32 s2, [r0,#8]
+ bl length3
+ vmov.f32 s3, #1.0
+ vdiv.f32 s3, s0
+
+ vldr.f32 s0, [r0]
+ vldr.f32 s1, [r0,#4]
+ vldr.f32 s2, [r0,#8]
+
+ vmul.f32 s0, s3
+ vmul.f32 s1, s3
+ vmul.f32 s2, s3
+
+ vstr.f32, s0, [r0]
+ vstr.f32, s1, [r0,#4]
+ vstr.f32, s2, [r0,#8]
bx lr
# args: posx, posy, posz, r
Please sign in to comment.
Something went wrong with that request. Please try again.