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

     1  // Code generated by "stringer -bitset -type CSPropBits"; DO NOT EDIT.
     2  
     3  package inlheur
     4  
     5  import "strconv"
     6  import "bytes"
     7  
     8  func _() {
     9  	// An "invalid array index" compiler error signifies that the constant values have changed.
    10  	// Re-run the stringer command to generate them again.
    11  	var x [1]struct{}
    12  	_ = x[CallSiteInLoop-1]
    13  	_ = x[CallSiteOnPanicPath-2]
    14  	_ = x[CallSiteInInitFunc-4]
    15  }
    16  
    17  var _CSPropBits_value = [...]uint64{
    18  	0x1, /* CallSiteInLoop */
    19  	0x2, /* CallSiteOnPanicPath */
    20  	0x4, /* CallSiteInInitFunc */
    21  }
    22  
    23  const _CSPropBits_name = "CallSiteInLoopCallSiteOnPanicPathCallSiteInInitFunc"
    24  
    25  var _CSPropBits_index = [...]uint8{0, 14, 33, 51}
    26  
    27  func (i CSPropBits) String() string {
    28  	var b bytes.Buffer
    29  
    30  	remain := uint64(i)
    31  	seen := false
    32  
    33  	for k, v := range _CSPropBits_value {
    34  		x := _CSPropBits_name[_CSPropBits_index[k]:_CSPropBits_index[k+1]]
    35  		if v == 0 {
    36  			if i == 0 {
    37  				b.WriteString(x)
    38  				return b.String()
    39  			}
    40  			continue
    41  		}
    42  		if (v & remain) == v {
    43  			remain &^= v
    44  			x := _CSPropBits_name[_CSPropBits_index[k]:_CSPropBits_index[k+1]]
    45  			if seen {
    46  				b.WriteString("|")
    47  			}
    48  			seen = true
    49  			b.WriteString(x)
    50  		}
    51  	}
    52  	if remain == 0 {
    53  		return b.String()
    54  	}
    55  	return "CSPropBits(0x" + strconv.FormatInt(int64(i), 16) + ")"
    56  }
    57  

View as plain text