github.com/llir/llvm@v0.3.6/asm/enum/fastmathflag_string2enum.go (about)

     1  // Code generated by "string2enum -linecomment -type FastMathFlag ../../ir/enum"; DO NOT EDIT.
     2  
     3  package enum
     4  
     5  import (
     6  	"fmt"
     7  
     8  	"github.com/llir/llvm/ir/enum"
     9  )
    10  
    11  func _() {
    12  	// An "invalid array index" compiler error signifies that the constant values have changed.
    13  	// Re-run the string2enum command to generate them again.
    14  	var x [1]struct{}
    15  	_ = x[enum.FastMathFlagAFn-0]
    16  	_ = x[enum.FastMathFlagARcp-1]
    17  	_ = x[enum.FastMathFlagContract-2]
    18  	_ = x[enum.FastMathFlagFast-3]
    19  	_ = x[enum.FastMathFlagNInf-4]
    20  	_ = x[enum.FastMathFlagNNaN-5]
    21  	_ = x[enum.FastMathFlagNSZ-6]
    22  	_ = x[enum.FastMathFlagReassoc-7]
    23  }
    24  
    25  const _FastMathFlag_name = "afnarcpcontractfastninfnnannszreassoc"
    26  
    27  var _FastMathFlag_index = [...]uint8{0, 3, 7, 15, 19, 23, 27, 30, 37}
    28  
    29  // FastMathFlagFromString returns the FastMathFlag enum corresponding to s.
    30  func FastMathFlagFromString(s string) enum.FastMathFlag {
    31  	if len(s) == 0 {
    32  		return 0
    33  	}
    34  	for i := range _FastMathFlag_index[:len(_FastMathFlag_index)-1] {
    35  		if s == _FastMathFlag_name[_FastMathFlag_index[i]:_FastMathFlag_index[i+1]] {
    36  			return enum.FastMathFlag(i)
    37  		}
    38  	}
    39  	panic(fmt.Errorf("unable to locate FastMathFlag enum corresponding to %q", s))
    40  }
    41  
    42  func _(s string) {
    43  	// Check for duplicate string values in type "FastMathFlag".
    44  	switch s {
    45  	// 0
    46  	case "afn":
    47  	// 1
    48  	case "arcp":
    49  	// 2
    50  	case "contract":
    51  	// 3
    52  	case "fast":
    53  	// 4
    54  	case "ninf":
    55  	// 5
    56  	case "nnan":
    57  	// 6
    58  	case "nsz":
    59  	// 7
    60  	case "reassoc":
    61  	}
    62  }