]> Cypherpunks repositories - gostls13.git/commitdiff
test: change index.go to test size of int, not GOARCH == "amd64"
authorIan Lance Taylor <iant@golang.org>
Thu, 8 Nov 2012 23:43:28 +0000 (15:43 -0800)
committerIan Lance Taylor <iant@golang.org>
Thu, 8 Nov 2012 23:43:28 +0000 (15:43 -0800)
Fixes the test to work correctly on other platforms with
64-bit ints, like Alpha.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6822099

test/index.go

index 528d7add474276e9566dfd0948413b1b6c2f1c1f..daab45f7a17a8ed4b33f409c6dca5c0a76a0ad2f 100644 (file)
@@ -13,7 +13,7 @@ import (
        "bufio"
        "fmt"
        "os"
-       "runtime"
+       "unsafe"
 )
 
 const prolog = `
@@ -214,9 +214,10 @@ func main() {
                                // the next pass from running.
                                // So run it as a separate check.
                                thisPass = 1
-                       } else if a == "s" && n == "" && (i == "i64big" || i == "i64bigger") && runtime.GOARCH == "amd64" {
-                               // On amd64, these huge numbers do fit in an int, so they are not
-                               // rejected at compile time.
+                       } else if a == "s" && n == "" && (i == "i64big" || i == "i64bigger") && unsafe.Sizeof(int(0)) > 4 {
+                               // If int is 64 bits, these huge
+                               // numbers do fit in an int, so they
+                               // are not rejected at compile time.
                                thisPass = 0
                        } else {
                                thisPass = 2