...

Source file src/cmd/compile/internal/inline/inlheur/funcpropbits_string.go

Documentation: cmd/compile/internal/inline/inlheur

     1  // Copyright 2023 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Code generated by "stringer -bitset -type FuncPropBits"; DO NOT EDIT.
     6  
     7  package inlheur
     8  
     9  import (
    10  	"bytes"
    11  	"strconv"
    12  )
    13  
    14  func _() {
    15  	// An "invalid array index" compiler error signifies that the constant values have changed.
    16  	// Re-run the stringer command to generate them again.
    17  	var x [1]struct{}
    18  	_ = x[FuncPropNeverReturns-1]
    19  }
    20  
    21  var _FuncPropBits_value = [...]uint64{
    22  	0x1, /* FuncPropNeverReturns */
    23  }
    24  
    25  const _FuncPropBits_name = "FuncPropNeverReturns"
    26  
    27  var _FuncPropBits_index = [...]uint8{0, 20}
    28  
    29  func (i FuncPropBits) String() string {
    30  	var b bytes.Buffer
    31  
    32  	remain := uint64(i)
    33  	seen := false
    34  
    35  	for k, v := range _FuncPropBits_value {
    36  		x := _FuncPropBits_name[_FuncPropBits_index[k]:_FuncPropBits_index[k+1]]
    37  		if v == 0 {
    38  			if i == 0 {
    39  				b.WriteString(x)
    40  				return b.String()
    41  			}
    42  			continue
    43  		}
    44  		if (v & remain) == v {
    45  			remain &^= v
    46  			x := _FuncPropBits_name[_FuncPropBits_index[k]:_FuncPropBits_index[k+1]]
    47  			if seen {
    48  				b.WriteString("|")
    49  			}
    50  			seen = true
    51  			b.WriteString(x)
    52  		}
    53  	}
    54  	if remain == 0 {
    55  		return b.String()
    56  	}
    57  	return "FuncPropBits(0x" + strconv.FormatInt(int64(i), 16) + ")"
    58  }
    59  

View as plain text