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

     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 ParamPropBits"; 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[ParamNoInfo-0]
    19  	_ = x[ParamFeedsInterfaceMethodCall-2]
    20  	_ = x[ParamMayFeedInterfaceMethodCall-4]
    21  	_ = x[ParamFeedsIndirectCall-8]
    22  	_ = x[ParamMayFeedIndirectCall-16]
    23  	_ = x[ParamFeedsIfOrSwitch-32]
    24  	_ = x[ParamMayFeedIfOrSwitch-64]
    25  }
    26  
    27  var _ParamPropBits_value = [...]uint64{
    28  	0x0,  /* ParamNoInfo */
    29  	0x2,  /* ParamFeedsInterfaceMethodCall */
    30  	0x4,  /* ParamMayFeedInterfaceMethodCall */
    31  	0x8,  /* ParamFeedsIndirectCall */
    32  	0x10, /* ParamMayFeedIndirectCall */
    33  	0x20, /* ParamFeedsIfOrSwitch */
    34  	0x40, /* ParamMayFeedIfOrSwitch */
    35  }
    36  
    37  const _ParamPropBits_name = "ParamNoInfoParamFeedsInterfaceMethodCallParamMayFeedInterfaceMethodCallParamFeedsIndirectCallParamMayFeedIndirectCallParamFeedsIfOrSwitchParamMayFeedIfOrSwitch"
    38  
    39  var _ParamPropBits_index = [...]uint8{0, 11, 40, 71, 93, 117, 137, 159}
    40  
    41  func (i ParamPropBits) String() string {
    42  	var b bytes.Buffer
    43  
    44  	remain := uint64(i)
    45  	seen := false
    46  
    47  	for k, v := range _ParamPropBits_value {
    48  		x := _ParamPropBits_name[_ParamPropBits_index[k]:_ParamPropBits_index[k+1]]
    49  		if v == 0 {
    50  			if i == 0 {
    51  				b.WriteString(x)
    52  				return b.String()
    53  			}
    54  			continue
    55  		}
    56  		if (v & remain) == v {
    57  			remain &^= v
    58  			x := _ParamPropBits_name[_ParamPropBits_index[k]:_ParamPropBits_index[k+1]]
    59  			if seen {
    60  				b.WriteString("|")
    61  			}
    62  			seen = true
    63  			b.WriteString(x)
    64  		}
    65  	}
    66  	if remain == 0 {
    67  		return b.String()
    68  	}
    69  	return "ParamPropBits(0x" + strconv.FormatInt(int64(i), 16) + ")"
    70  }