Skip to content

Commit

Permalink
Convert to short if
Browse files Browse the repository at this point in the history
  • Loading branch information
Vilsol committed Aug 30, 2021
1 parent 7b238b3 commit bf9d98a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions runtime/simplex.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,21 @@ func raw2d(seed int, x float64, y float64) float64 {
gi2 := perm(seed, ii+1+perm(seed, jj+1)) % 12

// Calculate the contribution from the three corners
t0 := 0.5 - x0*x0 - y0*y0
if t0 < 0 {
if t0 := 0.5 - x0*x0 - y0*y0; t0 < 0 {
n0 = 0.0
} else {
t0 *= t0
n0 = t0 * t0 * dot(grad3[gi0], x0, y0) // (x,y) of grad3 used for 2D gradient
}

t1 := 0.5 - x1*x1 - y1*y1
if t1 < 0 {
if t1 := 0.5 - x1*x1 - y1*y1; t1 < 0 {
n1 = 0.0
} else {
t1 *= t1
n1 = t1 * t1 * dot(grad3[gi1], x1, y1)
}

t2 := 0.5 - x2*x2 - y2*y2
if t2 < 0 {
if t2 := 0.5 - x2*x2 - y2*y2; t2 < 0 {
n2 = 0.0
} else {
t2 *= t2
Expand Down

0 comments on commit bf9d98a

Please sign in to comment.