diff options
author | R?my Oudompheng <oudomphe@phare.normalesup.org> | 2012-10-26 00:29:44 +0200 |
---|---|---|
committer | R?my Oudompheng <oudomphe@phare.normalesup.org> | 2012-10-26 00:29:44 +0200 |
commit | 5e227c8b54942eef8e6515f0e748486ba31df608 (patch) | |
tree | 8063e5241284c9c6aa5219630d6fe604d06fef6e /test/torture.go | |
parent | cc979688c3344c2684bfbfeaa426aa148b75b836 (diff) | |
download | go-5e227c8b54942eef8e6515f0e748486ba31df608.tar.gz |
cmd/6g: fix crash in cgen_bmul.
Used to print:
../test/torture.go:116: internal compiler error: bad width: 0463 (../test/torture.go:116) MOVB ,BX (0, 8)
R=nigeltao, rsc
CC=golang-dev
http://codereview.appspot.com/6736068
Diffstat (limited to 'test/torture.go')
-rw-r--r-- | test/torture.go | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/test/torture.go b/test/torture.go index 60870c3f4..4bce3a179 100644 --- a/test/torture.go +++ b/test/torture.go @@ -58,6 +58,64 @@ func determinant(m [4][4]float64) float64 { m[0][3]*m[1][2]*m[2][1]*m[3][0] } +// Compute the determinant of a 4x4-matrix by the sum +// over all index permutations. +func determinantInt(m [4][4]int) int { + return m[0][0]*m[1][1]*m[2][2]*m[3][3] - + m[0][0]*m[1][1]*m[2][3]*m[3][2] - + m[0][0]*m[1][2]*m[2][1]*m[3][3] + + m[0][0]*m[1][2]*m[2][3]*m[3][1] + + m[0][0]*m[1][3]*m[2][1]*m[3][2] - + m[0][0]*m[1][3]*m[2][2]*m[3][1] - + m[0][1]*m[1][0]*m[2][2]*m[3][3] + + m[0][1]*m[1][0]*m[2][3]*m[3][2] + + m[0][1]*m[1][2]*m[2][0]*m[3][3] - + m[0][1]*m[1][2]*m[2][3]*m[3][0] - + m[0][1]*m[1][3]*m[2][0]*m[3][2] + + m[0][1]*m[1][3]*m[2][2]*m[3][0] + + m[0][2]*m[1][0]*m[2][1]*m[3][3] - + m[0][2]*m[1][0]*m[2][3]*m[3][1] - + m[0][2]*m[1][1]*m[2][0]*m[3][3] + + m[0][2]*m[1][1]*m[2][3]*m[3][0] + + m[0][2]*m[1][3]*m[2][0]*m[3][1] - + m[0][2]*m[1][3]*m[2][1]*m[3][0] - + m[0][3]*m[1][0]*m[2][1]*m[3][2] + + m[0][3]*m[1][0]*m[2][2]*m[3][1] + + m[0][3]*m[1][1]*m[2][0]*m[3][2] - + m[0][3]*m[1][1]*m[2][2]*m[3][0] - + m[0][3]*m[1][2]*m[2][0]*m[3][1] + + m[0][3]*m[1][2]*m[2][1]*m[3][0] +} + +// Compute the determinant of a 4x4-matrix by the sum +// over all index permutations. +func determinantByte(m [4][4]byte) byte { + return m[0][0]*m[1][1]*m[2][2]*m[3][3] - + m[0][0]*m[1][1]*m[2][3]*m[3][2] - + m[0][0]*m[1][2]*m[2][1]*m[3][3] + + m[0][0]*m[1][2]*m[2][3]*m[3][1] + + m[0][0]*m[1][3]*m[2][1]*m[3][2] - + m[0][0]*m[1][3]*m[2][2]*m[3][1] - + m[0][1]*m[1][0]*m[2][2]*m[3][3] + + m[0][1]*m[1][0]*m[2][3]*m[3][2] + + m[0][1]*m[1][2]*m[2][0]*m[3][3] - + m[0][1]*m[1][2]*m[2][3]*m[3][0] - + m[0][1]*m[1][3]*m[2][0]*m[3][2] + + m[0][1]*m[1][3]*m[2][2]*m[3][0] + + m[0][2]*m[1][0]*m[2][1]*m[3][3] - + m[0][2]*m[1][0]*m[2][3]*m[3][1] - + m[0][2]*m[1][1]*m[2][0]*m[3][3] + + m[0][2]*m[1][1]*m[2][3]*m[3][0] + + m[0][2]*m[1][3]*m[2][0]*m[3][1] - + m[0][2]*m[1][3]*m[2][1]*m[3][0] - + m[0][3]*m[1][0]*m[2][1]*m[3][2] + + m[0][3]*m[1][0]*m[2][2]*m[3][1] + + m[0][3]*m[1][1]*m[2][0]*m[3][2] - + m[0][3]*m[1][1]*m[2][2]*m[3][0] - + m[0][3]*m[1][2]*m[2][0]*m[3][1] + + m[0][3]*m[1][2]*m[2][1]*m[3][0] +} + // A right-leaning tree of byte multiplications. func righttree(a, b, c, d uint8) uint8 { return a * (b * (c * (d * |