Reduce number of range and slice operators #239

Replace .. and ... with : and ..
This commit is contained in:
gingerBill
2018-08-01 21:34:59 +01:00
parent a6fe656f21
commit 0718f14774
31 changed files with 204 additions and 219 deletions
+8 -8
View File
@@ -164,7 +164,7 @@ cross :: proc[cross2, cross3];
vec_dot :: proc(a, b: $T/[$N]$E) -> E {
res: E;
for i in 0..N {
for i in 0..N-1 {
res += a[i] * b[i];
}
return res;
@@ -194,13 +194,13 @@ norm0 :: proc(v: $T/[$N]$E) -> T {
identity :: proc(T: type/[$N][N]$E) -> T {
m: T;
for i in 0..N do m[i][i] = E(1);
for i in 0..N-1 do m[i][i] = E(1);
return m;
}
transpose :: proc(m: $M/[$N][N]f32) -> M {
for j in 0..N {
for i in 0..N {
for j in 0..N-1 {
for i in 0..N-1 {
m[i][j], m[j][i] = m[j][i], m[i][j];
}
}
@@ -209,8 +209,8 @@ transpose :: proc(m: $M/[$N][N]f32) -> M {
mat3_mul :: proc(a, b: Mat3) -> Mat3 {
c: Mat3;
for j in 0..3 {
for i in 0..3 {
for j in 0..2 {
for i in 0..2 {
c[j][i] = a[0][i]*b[j][0] +
a[1][i]*b[j][1] +
a[2][i]*b[j][2];
@@ -221,8 +221,8 @@ mat3_mul :: proc(a, b: Mat3) -> Mat3 {
mat4_mul :: proc(a, b: Mat4) -> Mat4 {
c: Mat4;
for j in 0..4 {
for i in 0..4 {
for j in 0..3 {
for i in 0..3 {
c[j][i] = a[0][i]*b[j][0] +
a[1][i]*b[j][1] +
a[2][i]*b[j][2] +