]> Cypherpunks.ru repositories - gostls13.git/blob - test/inline_endian.go
[dev.boringcrypto] all: merge master into dev.boringcrypto
[gostls13.git] / test / inline_endian.go
1 // errorcheckwithauto -0 -m -d=inlfuncswithclosures=1
2
3 //go:build (386 || amd64 || arm64 || ppc64le || s390x) && !gcflags_noopt
4 // +build 386 amd64 arm64 ppc64le s390x
5 // +build !gcflags_noopt
6
7 // Copyright 2021 The Go Authors. All rights reserved.
8 // Use of this source code is governed by a BSD-style
9 // license that can be found in the LICENSE file.
10
11 // Similar to inline.go, but only for architectures that can merge loads.
12
13 package foo
14
15 import (
16         "encoding/binary"
17 )
18
19 // Ensure that simple encoding/binary functions are cheap enough
20 // that functions using them can also be inlined (issue 42958).
21 func endian(b []byte) uint64 { // ERROR "can inline endian" "b does not escape"
22         return binary.LittleEndian.Uint64(b) + binary.BigEndian.Uint64(b) // ERROR "inlining call to binary.littleEndian.Uint64" "inlining call to binary.bigEndian.Uint64"
23 }