Source file test/inline_math_bits_rotate.go

     1  // errorcheck -0 -m
     2  
     3  //go:build amd64
     4  
     5  // Copyright 2018 The Go Authors. All rights reserved.
     6  // Use of this source code is governed by a BSD-style
     7  // license that can be found in the LICENSE file.
     8  
     9  // Test that inlining of math/bits.RotateLeft* treats those calls as intrinsics.
    10  
    11  package p
    12  
    13  import "math/bits"
    14  
    15  var (
    16  	x8  uint8
    17  	x16 uint16
    18  	x32 uint32
    19  	x64 uint64
    20  	x   uint
    21  )
    22  
    23  func f() { // ERROR "can inline f"
    24  	x8 = bits.RotateLeft8(x8, 1)
    25  	x16 = bits.RotateLeft16(x16, 1)
    26  	x32 = bits.RotateLeft32(x32, 1)
    27  	x64 = bits.RotateLeft64(x64, 1)
    28  	x = bits.RotateLeft(x, 1)
    29  }
    30  

View as plain text