| // Copyright 2016 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // This test makes sure that we don't split a single |
| // load up into two separate loads. |
| func read1(b []byte) (uint16, uint16) { |
| // There is only a single read of b[0]. The two |
| // returned values must have the same low byte. |
| return uint16(v), uint16(v) | uint16(b[1])<<8 |
| done := make(chan struct{}) |
| fmt.Printf("x=%x y=%x\n", x, y) |
| func read2(b []byte) (uint16, uint16) { |
| // There is only a single read of b[1]. The two |
| // returned values must have the same high byte. |
| return v, uint16(b[0]) | v |
| done := make(chan struct{}) |
| if x&0xff00 != y&0xff00 { |
| fmt.Printf("x=%x y=%x\n", x, y) |