Black Lives Matter. Support the Equal Justice Initiative.

Source file test/inline_math_bits_rotate.go

Documentation: test

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

View as plain text