github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/cmd/compile/inline/inlheur/cspropbits_string.go (about)

     1  // Code generated by "stringer -bitset -type CSPropBits"; DO NOT EDIT.
     2  
     3  package inlheur
     4  
     5  import (
     6  	"bytes"
     7  	"strconv"
     8  )
     9  
    10  func _() {
    11  	// An "invalid array index" compiler error signifies that the constant values have changed.
    12  	// Re-run the stringer command to generate them again.
    13  	var x [1]struct{}
    14  	_ = x[CallSiteInLoop-1]
    15  	_ = x[CallSiteOnPanicPath-2]
    16  	_ = x[CallSiteInInitFunc-4]
    17  }
    18  
    19  var _CSPropBits_value = [...]uint64{
    20  	0x1, /* CallSiteInLoop */
    21  	0x2, /* CallSiteOnPanicPath */
    22  	0x4, /* CallSiteInInitFunc */
    23  }
    24  
    25  const _CSPropBits_name = "CallSiteInLoopCallSiteOnPanicPathCallSiteInInitFunc"
    26  
    27  var _CSPropBits_index = [...]uint8{0, 14, 33, 51}
    28  
    29  func (i CSPropBits) String() string {
    30  	var b bytes.Buffer
    31  
    32  	remain := uint64(i)
    33  	seen := false
    34  
    35  	for k, v := range _CSPropBits_value {
    36  		x := _CSPropBits_name[_CSPropBits_index[k]:_CSPropBits_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 := _CSPropBits_name[_CSPropBits_index[k]:_CSPropBits_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 "CSPropBits(0x" + strconv.FormatInt(int64(i), 16) + ")"
    58  }