~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to test/64bit.go

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-20 14:06:23 UTC
  • mfrom: (14.1.23 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130820140623-b414jfxi3m0qkmrq
Tags: 2:1.1.2-2ubuntu1
* Merge from Debian unstable (LP: #1211749, #1202027). Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - d/control,control.cross: Update Breaks/Replaces for Ubuntu
    versions to ensure smooth upgrades, regenerate control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// $G $D/$F.go && $L $F.$A && ./$A.out >tmp.go &&
2
 
// $G tmp.go && $L tmp.$A && ./$A.out || echo BUG: 64bit
3
 
// rm -f tmp.go
 
1
// runoutput
4
2
 
5
3
// Copyright 2009 The Go Authors. All rights reserved.
6
4
// Use of this source code is governed by a BSD-style
596
594
        "}\n" +
597
595
        "\n"
598
596
 
 
597
const binaryConstR0 = "func test%vBinaryR%v(a, add, sub, mul, div, mod, and, or, xor, andnot %v, dodiv bool) {\n" +
 
598
        "       const b %v = %v;\n" +
 
599
        "       const typ = `%s`;\n" +
 
600
        "       if n, op, want := a + b, `+`, add; n != want { ok=false; println(typ, `var`, a, op, `const`, b, `=`, n, `should be`, want); }\n" +
 
601
        "       if n, op, want := a - b, `-`, sub; n != want { ok=false; println(typ, `var`, a, op, `const`, b, `=`, n, `should be`, want); }\n" +
 
602
        "       if n, op, want := a * b, `*`, mul; n != want { ok=false; println(typ, `var`, a, op, `const`, b, `=`, n, `should be`, want); }\n" +
 
603
        "       if n, op, want := a & b, `&`, and; n != want { ok=false; println(typ, `var`, a, op, `const`, b, `=`, n, `should be`, want); }\n" +
 
604
        "       if n, op, want := a | b, `|`, or; n != want { ok=false; println(typ, `var`, a, op, `const`, b, `=`, n, `should be`, want); }\n" +
 
605
        "       if n, op, want := a ^ b, `^`, xor; n != want { ok=false; println(typ, `var`, a, op, `const`, b, `=`, n, `should be`, want); }\n" +
 
606
        "       if n, op, want := a &^ b, `&^`, andnot; n != want { ok=false; println(typ, `var`, a, op, `const`, b, `=`, n, `should be`, want); }\n" +
 
607
        "}\n" +
 
608
        "\n"
 
609
 
599
610
const shiftConstL = "func test%vShiftL%v(b uint64, left, right %v) {\n" +
600
611
        "       const a %v = %v;\n" +
601
612
        "       const typ = `%s`;\n" +
623
634
func constTests() {
624
635
        for i, a := range int64Values {
625
636
                fmt.Fprintf(bout, binaryConstL, "Int64", i, "int64", "int64", a, "int64")
626
 
                fmt.Fprintf(bout, binaryConstR, "Int64", i, "int64", "int64", a, "int64")
 
637
                if a.hi == 0 && a.lo == 0 {
 
638
                        fmt.Fprintf(bout, binaryConstR0, "Int64", i, "int64", "int64", a, "int64")
 
639
                } else {
 
640
                        fmt.Fprintf(bout, binaryConstR, "Int64", i, "int64", "int64", a, "int64")
 
641
                }
627
642
                fmt.Fprintf(bout, shiftConstL, "Int64", i, "int64", "int64", a, "int64")
628
643
        }
629
644
        for i, a := range uint64Values {
630
645
                fmt.Fprintf(bout, binaryConstL, "Uint64", i, "uint64", "uint64", a, "uint64")
631
 
                fmt.Fprintf(bout, binaryConstR, "Uint64", i, "uint64", "uint64", a, "uint64")
 
646
                if a.hi == 0 && a.lo == 0 {
 
647
                        fmt.Fprintf(bout, binaryConstR0, "Uint64", i, "uint64", "uint64", a, "uint64")
 
648
                } else {
 
649
                        fmt.Fprintf(bout, binaryConstR, "Uint64", i, "uint64", "uint64", a, "uint64")
 
650
                }
632
651
                fmt.Fprintf(bout, shiftConstL, "Uint64", i, "uint64", "uint64", a, "uint64")
633
652
        }
634
653
        for i, a := range shiftValues {