Skip to content

Instantly share code, notes, and snippets.

@hajimehoshi
Created March 5, 2017 05:54
Show Gist options
  • Save hajimehoshi/11b8b78e1b9b147a54b0c02aa10d6998 to your computer and use it in GitHub Desktop.
Save hajimehoshi/11b8b78e1b9b147a54b0c02aa10d6998 to your computer and use it in GitHub Desktop.
100 < 1 on GOARCH=arm
package main
type IF interface {
Int4(int) (int, int, int, int)
}
type impl struct{}
func (p *impl) Int4(i int) (int, int, int, int) {
return 0, 0, 16, 16
}
func vertices(impl IF, width, height int, g []float32) {
l := 1
vs := make([]float32, l*40)
g0 := float32(g[0])
g1 := float32(g[1])
g2 := float32(g[2])
g3 := float32(g[3])
g4 := float32(g[4])
g5 := float32(g[5])
w := 1
h := 1
for h < height {
h *= 2
}
wf := float32(w)
hf := float32(h)
n := 0
for i := 0; i < 1; i++ {
dx0, dy0, dx1, dy1 := impl.Int4(i)
x0, y0, x1, y1 := float32(dx0), float32(dy0), float32(dx1), float32(dy1)
sx0, sy0, sx1, sy1 := impl.Int4(i)
u0, v0, u1, v1 := float32(sx0), float32(sy0), float32(sx1), float32(sy1)
u1 -= 1.0 / wf / 256
v1 -= 1.0 / hf / 256
vs[n] = x0
vs[n+1] = y0
vs[n+2] = u0
vs[n+3] = v0
vs[n+4] = g0
vs[n+5] = g1
vs[n+6] = g2
vs[n+7] = g3
vs[n+8] = g4
vs[n+9] = g5
vs[n+10] = x1
vs[n+11] = y0
vs[n+12] = u1
vs[n+13] = v0
vs[n+14] = g0
vs[n+15] = g1
vs[n+16] = g2
vs[n+17] = g3
vs[n+18] = g4
vs[n+19] = g5
if g5 < 1 {
println(int(g5), "<", "1 =", g5 < 1)
panic("100 < 1")
}
vs[n+20] = x0
vs[n+21] = y1
vs[n+22] = u0
vs[n+23] = v1
}
}
func main() {
vertices(&impl{}, 16, 16, []float32{0, 0, 0, 0, 100, 100})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment