Files
kubevpn/vendor/github.com/expr-lang/expr/vm/runtime/helpers[generated].go
2025-04-19 10:06:56 +08:00

3719 lines
74 KiB
Plaintext

// Code generated by vm/runtime/helpers/main.go. DO NOT EDIT.
package runtime
import (
"fmt"
"reflect"
"time"
)
func Equal(a, b interface{}) bool {
switch x := a.(type) {
case uint:
switch y := b.(type) {
case uint:
return int(x) == int(y)
case uint8:
return int(x) == int(y)
case uint16:
return int(x) == int(y)
case uint32:
return int(x) == int(y)
case uint64:
return int(x) == int(y)
case int:
return int(x) == int(y)
case int8:
return int(x) == int(y)
case int16:
return int(x) == int(y)
case int32:
return int(x) == int(y)
case int64:
return int(x) == int(y)
case float32:
return float64(x) == float64(y)
case float64:
return float64(x) == float64(y)
}
case uint8:
switch y := b.(type) {
case uint:
return int(x) == int(y)
case uint8:
return int(x) == int(y)
case uint16:
return int(x) == int(y)
case uint32:
return int(x) == int(y)
case uint64:
return int(x) == int(y)
case int:
return int(x) == int(y)
case int8:
return int(x) == int(y)
case int16:
return int(x) == int(y)
case int32:
return int(x) == int(y)
case int64:
return int(x) == int(y)
case float32:
return float64(x) == float64(y)
case float64:
return float64(x) == float64(y)
}
case uint16:
switch y := b.(type) {
case uint:
return int(x) == int(y)
case uint8:
return int(x) == int(y)
case uint16:
return int(x) == int(y)
case uint32:
return int(x) == int(y)
case uint64:
return int(x) == int(y)
case int:
return int(x) == int(y)
case int8:
return int(x) == int(y)
case int16:
return int(x) == int(y)
case int32:
return int(x) == int(y)
case int64:
return int(x) == int(y)
case float32:
return float64(x) == float64(y)
case float64:
return float64(x) == float64(y)
}
case uint32:
switch y := b.(type) {
case uint:
return int(x) == int(y)
case uint8:
return int(x) == int(y)
case uint16:
return int(x) == int(y)
case uint32:
return int(x) == int(y)
case uint64:
return int(x) == int(y)
case int:
return int(x) == int(y)
case int8:
return int(x) == int(y)
case int16:
return int(x) == int(y)
case int32:
return int(x) == int(y)
case int64:
return int(x) == int(y)
case float32:
return float64(x) == float64(y)
case float64:
return float64(x) == float64(y)
}
case uint64:
switch y := b.(type) {
case uint:
return int(x) == int(y)
case uint8:
return int(x) == int(y)
case uint16:
return int(x) == int(y)
case uint32:
return int(x) == int(y)
case uint64:
return int(x) == int(y)
case int:
return int(x) == int(y)
case int8:
return int(x) == int(y)
case int16:
return int(x) == int(y)
case int32:
return int(x) == int(y)
case int64:
return int(x) == int(y)
case float32:
return float64(x) == float64(y)
case float64:
return float64(x) == float64(y)
}
case int:
switch y := b.(type) {
case uint:
return int(x) == int(y)
case uint8:
return int(x) == int(y)
case uint16:
return int(x) == int(y)
case uint32:
return int(x) == int(y)
case uint64:
return int(x) == int(y)
case int:
return int(x) == int(y)
case int8:
return int(x) == int(y)
case int16:
return int(x) == int(y)
case int32:
return int(x) == int(y)
case int64:
return int(x) == int(y)
case float32:
return float64(x) == float64(y)
case float64:
return float64(x) == float64(y)
}
case int8:
switch y := b.(type) {
case uint:
return int(x) == int(y)
case uint8:
return int(x) == int(y)
case uint16:
return int(x) == int(y)
case uint32:
return int(x) == int(y)
case uint64:
return int(x) == int(y)
case int:
return int(x) == int(y)
case int8:
return int(x) == int(y)
case int16:
return int(x) == int(y)
case int32:
return int(x) == int(y)
case int64:
return int(x) == int(y)
case float32:
return float64(x) == float64(y)
case float64:
return float64(x) == float64(y)
}
case int16:
switch y := b.(type) {
case uint:
return int(x) == int(y)
case uint8:
return int(x) == int(y)
case uint16:
return int(x) == int(y)
case uint32:
return int(x) == int(y)
case uint64:
return int(x) == int(y)
case int:
return int(x) == int(y)
case int8:
return int(x) == int(y)
case int16:
return int(x) == int(y)
case int32:
return int(x) == int(y)
case int64:
return int(x) == int(y)
case float32:
return float64(x) == float64(y)
case float64:
return float64(x) == float64(y)
}
case int32:
switch y := b.(type) {
case uint:
return int(x) == int(y)
case uint8:
return int(x) == int(y)
case uint16:
return int(x) == int(y)
case uint32:
return int(x) == int(y)
case uint64:
return int(x) == int(y)
case int:
return int(x) == int(y)
case int8:
return int(x) == int(y)
case int16:
return int(x) == int(y)
case int32:
return int(x) == int(y)
case int64:
return int(x) == int(y)
case float32:
return float64(x) == float64(y)
case float64:
return float64(x) == float64(y)
}
case int64:
switch y := b.(type) {
case uint:
return int(x) == int(y)
case uint8:
return int(x) == int(y)
case uint16:
return int(x) == int(y)
case uint32:
return int(x) == int(y)
case uint64:
return int(x) == int(y)
case int:
return int(x) == int(y)
case int8:
return int(x) == int(y)
case int16:
return int(x) == int(y)
case int32:
return int(x) == int(y)
case int64:
return int(x) == int(y)
case float32:
return float64(x) == float64(y)
case float64:
return float64(x) == float64(y)
}
case float32:
switch y := b.(type) {
case uint:
return float64(x) == float64(y)
case uint8:
return float64(x) == float64(y)
case uint16:
return float64(x) == float64(y)
case uint32:
return float64(x) == float64(y)
case uint64:
return float64(x) == float64(y)
case int:
return float64(x) == float64(y)
case int8:
return float64(x) == float64(y)
case int16:
return float64(x) == float64(y)
case int32:
return float64(x) == float64(y)
case int64:
return float64(x) == float64(y)
case float32:
return float64(x) == float64(y)
case float64:
return float64(x) == float64(y)
}
case float64:
switch y := b.(type) {
case uint:
return float64(x) == float64(y)
case uint8:
return float64(x) == float64(y)
case uint16:
return float64(x) == float64(y)
case uint32:
return float64(x) == float64(y)
case uint64:
return float64(x) == float64(y)
case int:
return float64(x) == float64(y)
case int8:
return float64(x) == float64(y)
case int16:
return float64(x) == float64(y)
case int32:
return float64(x) == float64(y)
case int64:
return float64(x) == float64(y)
case float32:
return float64(x) == float64(y)
case float64:
return float64(x) == float64(y)
}
case []any:
switch y := b.(type) {
case []string:
if len(x) != len(y) {
return false
}
for i := range x {
if !Equal(x[i], y[i]) {
return false
}
}
return true
case []uint:
if len(x) != len(y) {
return false
}
for i := range x {
if !Equal(x[i], y[i]) {
return false
}
}
return true
case []uint8:
if len(x) != len(y) {
return false
}
for i := range x {
if !Equal(x[i], y[i]) {
return false
}
}
return true
case []uint16:
if len(x) != len(y) {
return false
}
for i := range x {
if !Equal(x[i], y[i]) {
return false
}
}
return true
case []uint32:
if len(x) != len(y) {
return false
}
for i := range x {
if !Equal(x[i], y[i]) {
return false
}
}
return true
case []uint64:
if len(x) != len(y) {
return false
}
for i := range x {
if !Equal(x[i], y[i]) {
return false
}
}
return true
case []int:
if len(x) != len(y) {
return false
}
for i := range x {
if !Equal(x[i], y[i]) {
return false
}
}
return true
case []int8:
if len(x) != len(y) {
return false
}
for i := range x {
if !Equal(x[i], y[i]) {
return false
}
}
return true
case []int16:
if len(x) != len(y) {
return false
}
for i := range x {
if !Equal(x[i], y[i]) {
return false
}
}
return true
case []int32:
if len(x) != len(y) {
return false
}
for i := range x {
if !Equal(x[i], y[i]) {
return false
}
}
return true
case []int64:
if len(x) != len(y) {
return false
}
for i := range x {
if !Equal(x[i], y[i]) {
return false
}
}
return true
case []float32:
if len(x) != len(y) {
return false
}
for i := range x {
if !Equal(x[i], y[i]) {
return false
}
}
return true
case []float64:
if len(x) != len(y) {
return false
}
for i := range x {
if !Equal(x[i], y[i]) {
return false
}
}
return true
case []any:
if len(x) != len(y) {
return false
}
for i := range x {
if !Equal(x[i], y[i]) {
return false
}
}
return true
}
case []string:
switch y := b.(type) {
case []any:
return Equal(y, x)
case []string:
if len(x) != len(y) {
return false
}
for i := range x {
if x[i] != y[i] {
return false
}
}
return true
}
case []uint:
switch y := b.(type) {
case []any:
return Equal(y, x)
case []uint:
if len(x) != len(y) {
return false
}
for i := range x {
if x[i] != y[i] {
return false
}
}
return true
}
case []uint8:
switch y := b.(type) {
case []any:
return Equal(y, x)
case []uint8:
if len(x) != len(y) {
return false
}
for i := range x {
if x[i] != y[i] {
return false
}
}
return true
}
case []uint16:
switch y := b.(type) {
case []any:
return Equal(y, x)
case []uint16:
if len(x) != len(y) {
return false
}
for i := range x {
if x[i] != y[i] {
return false
}
}
return true
}
case []uint32:
switch y := b.(type) {
case []any:
return Equal(y, x)
case []uint32:
if len(x) != len(y) {
return false
}
for i := range x {
if x[i] != y[i] {
return false
}
}
return true
}
case []uint64:
switch y := b.(type) {
case []any:
return Equal(y, x)
case []uint64:
if len(x) != len(y) {
return false
}
for i := range x {
if x[i] != y[i] {
return false
}
}
return true
}
case []int:
switch y := b.(type) {
case []any:
return Equal(y, x)
case []int:
if len(x) != len(y) {
return false
}
for i := range x {
if x[i] != y[i] {
return false
}
}
return true
}
case []int8:
switch y := b.(type) {
case []any:
return Equal(y, x)
case []int8:
if len(x) != len(y) {
return false
}
for i := range x {
if x[i] != y[i] {
return false
}
}
return true
}
case []int16:
switch y := b.(type) {
case []any:
return Equal(y, x)
case []int16:
if len(x) != len(y) {
return false
}
for i := range x {
if x[i] != y[i] {
return false
}
}
return true
}
case []int32:
switch y := b.(type) {
case []any:
return Equal(y, x)
case []int32:
if len(x) != len(y) {
return false
}
for i := range x {
if x[i] != y[i] {
return false
}
}
return true
}
case []int64:
switch y := b.(type) {
case []any:
return Equal(y, x)
case []int64:
if len(x) != len(y) {
return false
}
for i := range x {
if x[i] != y[i] {
return false
}
}
return true
}
case []float32:
switch y := b.(type) {
case []any:
return Equal(y, x)
case []float32:
if len(x) != len(y) {
return false
}
for i := range x {
if x[i] != y[i] {
return false
}
}
return true
}
case []float64:
switch y := b.(type) {
case []any:
return Equal(y, x)
case []float64:
if len(x) != len(y) {
return false
}
for i := range x {
if x[i] != y[i] {
return false
}
}
return true
}
case string:
switch y := b.(type) {
case string:
return x == y
}
case time.Time:
switch y := b.(type) {
case time.Time:
return x.Equal(y)
}
case time.Duration:
switch y := b.(type) {
case time.Duration:
return x == y
}
case bool:
switch y := b.(type) {
case bool:
return x == y
}
}
if IsNil(a) && IsNil(b) {
return true
}
return reflect.DeepEqual(a, b)
}
func Less(a, b interface{}) bool {
switch x := a.(type) {
case uint:
switch y := b.(type) {
case uint:
return int(x) < int(y)
case uint8:
return int(x) < int(y)
case uint16:
return int(x) < int(y)
case uint32:
return int(x) < int(y)
case uint64:
return int(x) < int(y)
case int:
return int(x) < int(y)
case int8:
return int(x) < int(y)
case int16:
return int(x) < int(y)
case int32:
return int(x) < int(y)
case int64:
return int(x) < int(y)
case float32:
return float64(x) < float64(y)
case float64:
return float64(x) < float64(y)
}
case uint8:
switch y := b.(type) {
case uint:
return int(x) < int(y)
case uint8:
return int(x) < int(y)
case uint16:
return int(x) < int(y)
case uint32:
return int(x) < int(y)
case uint64:
return int(x) < int(y)
case int:
return int(x) < int(y)
case int8:
return int(x) < int(y)
case int16:
return int(x) < int(y)
case int32:
return int(x) < int(y)
case int64:
return int(x) < int(y)
case float32:
return float64(x) < float64(y)
case float64:
return float64(x) < float64(y)
}
case uint16:
switch y := b.(type) {
case uint:
return int(x) < int(y)
case uint8:
return int(x) < int(y)
case uint16:
return int(x) < int(y)
case uint32:
return int(x) < int(y)
case uint64:
return int(x) < int(y)
case int:
return int(x) < int(y)
case int8:
return int(x) < int(y)
case int16:
return int(x) < int(y)
case int32:
return int(x) < int(y)
case int64:
return int(x) < int(y)
case float32:
return float64(x) < float64(y)
case float64:
return float64(x) < float64(y)
}
case uint32:
switch y := b.(type) {
case uint:
return int(x) < int(y)
case uint8:
return int(x) < int(y)
case uint16:
return int(x) < int(y)
case uint32:
return int(x) < int(y)
case uint64:
return int(x) < int(y)
case int:
return int(x) < int(y)
case int8:
return int(x) < int(y)
case int16:
return int(x) < int(y)
case int32:
return int(x) < int(y)
case int64:
return int(x) < int(y)
case float32:
return float64(x) < float64(y)
case float64:
return float64(x) < float64(y)
}
case uint64:
switch y := b.(type) {
case uint:
return int(x) < int(y)
case uint8:
return int(x) < int(y)
case uint16:
return int(x) < int(y)
case uint32:
return int(x) < int(y)
case uint64:
return int(x) < int(y)
case int:
return int(x) < int(y)
case int8:
return int(x) < int(y)
case int16:
return int(x) < int(y)
case int32:
return int(x) < int(y)
case int64:
return int(x) < int(y)
case float32:
return float64(x) < float64(y)
case float64:
return float64(x) < float64(y)
}
case int:
switch y := b.(type) {
case uint:
return int(x) < int(y)
case uint8:
return int(x) < int(y)
case uint16:
return int(x) < int(y)
case uint32:
return int(x) < int(y)
case uint64:
return int(x) < int(y)
case int:
return int(x) < int(y)
case int8:
return int(x) < int(y)
case int16:
return int(x) < int(y)
case int32:
return int(x) < int(y)
case int64:
return int(x) < int(y)
case float32:
return float64(x) < float64(y)
case float64:
return float64(x) < float64(y)
}
case int8:
switch y := b.(type) {
case uint:
return int(x) < int(y)
case uint8:
return int(x) < int(y)
case uint16:
return int(x) < int(y)
case uint32:
return int(x) < int(y)
case uint64:
return int(x) < int(y)
case int:
return int(x) < int(y)
case int8:
return int(x) < int(y)
case int16:
return int(x) < int(y)
case int32:
return int(x) < int(y)
case int64:
return int(x) < int(y)
case float32:
return float64(x) < float64(y)
case float64:
return float64(x) < float64(y)
}
case int16:
switch y := b.(type) {
case uint:
return int(x) < int(y)
case uint8:
return int(x) < int(y)
case uint16:
return int(x) < int(y)
case uint32:
return int(x) < int(y)
case uint64:
return int(x) < int(y)
case int:
return int(x) < int(y)
case int8:
return int(x) < int(y)
case int16:
return int(x) < int(y)
case int32:
return int(x) < int(y)
case int64:
return int(x) < int(y)
case float32:
return float64(x) < float64(y)
case float64:
return float64(x) < float64(y)
}
case int32:
switch y := b.(type) {
case uint:
return int(x) < int(y)
case uint8:
return int(x) < int(y)
case uint16:
return int(x) < int(y)
case uint32:
return int(x) < int(y)
case uint64:
return int(x) < int(y)
case int:
return int(x) < int(y)
case int8:
return int(x) < int(y)
case int16:
return int(x) < int(y)
case int32:
return int(x) < int(y)
case int64:
return int(x) < int(y)
case float32:
return float64(x) < float64(y)
case float64:
return float64(x) < float64(y)
}
case int64:
switch y := b.(type) {
case uint:
return int(x) < int(y)
case uint8:
return int(x) < int(y)
case uint16:
return int(x) < int(y)
case uint32:
return int(x) < int(y)
case uint64:
return int(x) < int(y)
case int:
return int(x) < int(y)
case int8:
return int(x) < int(y)
case int16:
return int(x) < int(y)
case int32:
return int(x) < int(y)
case int64:
return int(x) < int(y)
case float32:
return float64(x) < float64(y)
case float64:
return float64(x) < float64(y)
}
case float32:
switch y := b.(type) {
case uint:
return float64(x) < float64(y)
case uint8:
return float64(x) < float64(y)
case uint16:
return float64(x) < float64(y)
case uint32:
return float64(x) < float64(y)
case uint64:
return float64(x) < float64(y)
case int:
return float64(x) < float64(y)
case int8:
return float64(x) < float64(y)
case int16:
return float64(x) < float64(y)
case int32:
return float64(x) < float64(y)
case int64:
return float64(x) < float64(y)
case float32:
return float64(x) < float64(y)
case float64:
return float64(x) < float64(y)
}
case float64:
switch y := b.(type) {
case uint:
return float64(x) < float64(y)
case uint8:
return float64(x) < float64(y)
case uint16:
return float64(x) < float64(y)
case uint32:
return float64(x) < float64(y)
case uint64:
return float64(x) < float64(y)
case int:
return float64(x) < float64(y)
case int8:
return float64(x) < float64(y)
case int16:
return float64(x) < float64(y)
case int32:
return float64(x) < float64(y)
case int64:
return float64(x) < float64(y)
case float32:
return float64(x) < float64(y)
case float64:
return float64(x) < float64(y)
}
case string:
switch y := b.(type) {
case string:
return x < y
}
case time.Time:
switch y := b.(type) {
case time.Time:
return x.Before(y)
}
case time.Duration:
switch y := b.(type) {
case time.Duration:
return x < y
}
}
panic(fmt.Sprintf("invalid operation: %T < %T", a, b))
}
func More(a, b interface{}) bool {
switch x := a.(type) {
case uint:
switch y := b.(type) {
case uint:
return int(x) > int(y)
case uint8:
return int(x) > int(y)
case uint16:
return int(x) > int(y)
case uint32:
return int(x) > int(y)
case uint64:
return int(x) > int(y)
case int:
return int(x) > int(y)
case int8:
return int(x) > int(y)
case int16:
return int(x) > int(y)
case int32:
return int(x) > int(y)
case int64:
return int(x) > int(y)
case float32:
return float64(x) > float64(y)
case float64:
return float64(x) > float64(y)
}
case uint8:
switch y := b.(type) {
case uint:
return int(x) > int(y)
case uint8:
return int(x) > int(y)
case uint16:
return int(x) > int(y)
case uint32:
return int(x) > int(y)
case uint64:
return int(x) > int(y)
case int:
return int(x) > int(y)
case int8:
return int(x) > int(y)
case int16:
return int(x) > int(y)
case int32:
return int(x) > int(y)
case int64:
return int(x) > int(y)
case float32:
return float64(x) > float64(y)
case float64:
return float64(x) > float64(y)
}
case uint16:
switch y := b.(type) {
case uint:
return int(x) > int(y)
case uint8:
return int(x) > int(y)
case uint16:
return int(x) > int(y)
case uint32:
return int(x) > int(y)
case uint64:
return int(x) > int(y)
case int:
return int(x) > int(y)
case int8:
return int(x) > int(y)
case int16:
return int(x) > int(y)
case int32:
return int(x) > int(y)
case int64:
return int(x) > int(y)
case float32:
return float64(x) > float64(y)
case float64:
return float64(x) > float64(y)
}
case uint32:
switch y := b.(type) {
case uint:
return int(x) > int(y)
case uint8:
return int(x) > int(y)
case uint16:
return int(x) > int(y)
case uint32:
return int(x) > int(y)
case uint64:
return int(x) > int(y)
case int:
return int(x) > int(y)
case int8:
return int(x) > int(y)
case int16:
return int(x) > int(y)
case int32:
return int(x) > int(y)
case int64:
return int(x) > int(y)
case float32:
return float64(x) > float64(y)
case float64:
return float64(x) > float64(y)
}
case uint64:
switch y := b.(type) {
case uint:
return int(x) > int(y)
case uint8:
return int(x) > int(y)
case uint16:
return int(x) > int(y)
case uint32:
return int(x) > int(y)
case uint64:
return int(x) > int(y)
case int:
return int(x) > int(y)
case int8:
return int(x) > int(y)
case int16:
return int(x) > int(y)
case int32:
return int(x) > int(y)
case int64:
return int(x) > int(y)
case float32:
return float64(x) > float64(y)
case float64:
return float64(x) > float64(y)
}
case int:
switch y := b.(type) {
case uint:
return int(x) > int(y)
case uint8:
return int(x) > int(y)
case uint16:
return int(x) > int(y)
case uint32:
return int(x) > int(y)
case uint64:
return int(x) > int(y)
case int:
return int(x) > int(y)
case int8:
return int(x) > int(y)
case int16:
return int(x) > int(y)
case int32:
return int(x) > int(y)
case int64:
return int(x) > int(y)
case float32:
return float64(x) > float64(y)
case float64:
return float64(x) > float64(y)
}
case int8:
switch y := b.(type) {
case uint:
return int(x) > int(y)
case uint8:
return int(x) > int(y)
case uint16:
return int(x) > int(y)
case uint32:
return int(x) > int(y)
case uint64:
return int(x) > int(y)
case int:
return int(x) > int(y)
case int8:
return int(x) > int(y)
case int16:
return int(x) > int(y)
case int32:
return int(x) > int(y)
case int64:
return int(x) > int(y)
case float32:
return float64(x) > float64(y)
case float64:
return float64(x) > float64(y)
}
case int16:
switch y := b.(type) {
case uint:
return int(x) > int(y)
case uint8:
return int(x) > int(y)
case uint16:
return int(x) > int(y)
case uint32:
return int(x) > int(y)
case uint64:
return int(x) > int(y)
case int:
return int(x) > int(y)
case int8:
return int(x) > int(y)
case int16:
return int(x) > int(y)
case int32:
return int(x) > int(y)
case int64:
return int(x) > int(y)
case float32:
return float64(x) > float64(y)
case float64:
return float64(x) > float64(y)
}
case int32:
switch y := b.(type) {
case uint:
return int(x) > int(y)
case uint8:
return int(x) > int(y)
case uint16:
return int(x) > int(y)
case uint32:
return int(x) > int(y)
case uint64:
return int(x) > int(y)
case int:
return int(x) > int(y)
case int8:
return int(x) > int(y)
case int16:
return int(x) > int(y)
case int32:
return int(x) > int(y)
case int64:
return int(x) > int(y)
case float32:
return float64(x) > float64(y)
case float64:
return float64(x) > float64(y)
}
case int64:
switch y := b.(type) {
case uint:
return int(x) > int(y)
case uint8:
return int(x) > int(y)
case uint16:
return int(x) > int(y)
case uint32:
return int(x) > int(y)
case uint64:
return int(x) > int(y)
case int:
return int(x) > int(y)
case int8:
return int(x) > int(y)
case int16:
return int(x) > int(y)
case int32:
return int(x) > int(y)
case int64:
return int(x) > int(y)
case float32:
return float64(x) > float64(y)
case float64:
return float64(x) > float64(y)
}
case float32:
switch y := b.(type) {
case uint:
return float64(x) > float64(y)
case uint8:
return float64(x) > float64(y)
case uint16:
return float64(x) > float64(y)
case uint32:
return float64(x) > float64(y)
case uint64:
return float64(x) > float64(y)
case int:
return float64(x) > float64(y)
case int8:
return float64(x) > float64(y)
case int16:
return float64(x) > float64(y)
case int32:
return float64(x) > float64(y)
case int64:
return float64(x) > float64(y)
case float32:
return float64(x) > float64(y)
case float64:
return float64(x) > float64(y)
}
case float64:
switch y := b.(type) {
case uint:
return float64(x) > float64(y)
case uint8:
return float64(x) > float64(y)
case uint16:
return float64(x) > float64(y)
case uint32:
return float64(x) > float64(y)
case uint64:
return float64(x) > float64(y)
case int:
return float64(x) > float64(y)
case int8:
return float64(x) > float64(y)
case int16:
return float64(x) > float64(y)
case int32:
return float64(x) > float64(y)
case int64:
return float64(x) > float64(y)
case float32:
return float64(x) > float64(y)
case float64:
return float64(x) > float64(y)
}
case string:
switch y := b.(type) {
case string:
return x > y
}
case time.Time:
switch y := b.(type) {
case time.Time:
return x.After(y)
}
case time.Duration:
switch y := b.(type) {
case time.Duration:
return x > y
}
}
panic(fmt.Sprintf("invalid operation: %T > %T", a, b))
}
func LessOrEqual(a, b interface{}) bool {
switch x := a.(type) {
case uint:
switch y := b.(type) {
case uint:
return int(x) <= int(y)
case uint8:
return int(x) <= int(y)
case uint16:
return int(x) <= int(y)
case uint32:
return int(x) <= int(y)
case uint64:
return int(x) <= int(y)
case int:
return int(x) <= int(y)
case int8:
return int(x) <= int(y)
case int16:
return int(x) <= int(y)
case int32:
return int(x) <= int(y)
case int64:
return int(x) <= int(y)
case float32:
return float64(x) <= float64(y)
case float64:
return float64(x) <= float64(y)
}
case uint8:
switch y := b.(type) {
case uint:
return int(x) <= int(y)
case uint8:
return int(x) <= int(y)
case uint16:
return int(x) <= int(y)
case uint32:
return int(x) <= int(y)
case uint64:
return int(x) <= int(y)
case int:
return int(x) <= int(y)
case int8:
return int(x) <= int(y)
case int16:
return int(x) <= int(y)
case int32:
return int(x) <= int(y)
case int64:
return int(x) <= int(y)
case float32:
return float64(x) <= float64(y)
case float64:
return float64(x) <= float64(y)
}
case uint16:
switch y := b.(type) {
case uint:
return int(x) <= int(y)
case uint8:
return int(x) <= int(y)
case uint16:
return int(x) <= int(y)
case uint32:
return int(x) <= int(y)
case uint64:
return int(x) <= int(y)
case int:
return int(x) <= int(y)
case int8:
return int(x) <= int(y)
case int16:
return int(x) <= int(y)
case int32:
return int(x) <= int(y)
case int64:
return int(x) <= int(y)
case float32:
return float64(x) <= float64(y)
case float64:
return float64(x) <= float64(y)
}
case uint32:
switch y := b.(type) {
case uint:
return int(x) <= int(y)
case uint8:
return int(x) <= int(y)
case uint16:
return int(x) <= int(y)
case uint32:
return int(x) <= int(y)
case uint64:
return int(x) <= int(y)
case int:
return int(x) <= int(y)
case int8:
return int(x) <= int(y)
case int16:
return int(x) <= int(y)
case int32:
return int(x) <= int(y)
case int64:
return int(x) <= int(y)
case float32:
return float64(x) <= float64(y)
case float64:
return float64(x) <= float64(y)
}
case uint64:
switch y := b.(type) {
case uint:
return int(x) <= int(y)
case uint8:
return int(x) <= int(y)
case uint16:
return int(x) <= int(y)
case uint32:
return int(x) <= int(y)
case uint64:
return int(x) <= int(y)
case int:
return int(x) <= int(y)
case int8:
return int(x) <= int(y)
case int16:
return int(x) <= int(y)
case int32:
return int(x) <= int(y)
case int64:
return int(x) <= int(y)
case float32:
return float64(x) <= float64(y)
case float64:
return float64(x) <= float64(y)
}
case int:
switch y := b.(type) {
case uint:
return int(x) <= int(y)
case uint8:
return int(x) <= int(y)
case uint16:
return int(x) <= int(y)
case uint32:
return int(x) <= int(y)
case uint64:
return int(x) <= int(y)
case int:
return int(x) <= int(y)
case int8:
return int(x) <= int(y)
case int16:
return int(x) <= int(y)
case int32:
return int(x) <= int(y)
case int64:
return int(x) <= int(y)
case float32:
return float64(x) <= float64(y)
case float64:
return float64(x) <= float64(y)
}
case int8:
switch y := b.(type) {
case uint:
return int(x) <= int(y)
case uint8:
return int(x) <= int(y)
case uint16:
return int(x) <= int(y)
case uint32:
return int(x) <= int(y)
case uint64:
return int(x) <= int(y)
case int:
return int(x) <= int(y)
case int8:
return int(x) <= int(y)
case int16:
return int(x) <= int(y)
case int32:
return int(x) <= int(y)
case int64:
return int(x) <= int(y)
case float32:
return float64(x) <= float64(y)
case float64:
return float64(x) <= float64(y)
}
case int16:
switch y := b.(type) {
case uint:
return int(x) <= int(y)
case uint8:
return int(x) <= int(y)
case uint16:
return int(x) <= int(y)
case uint32:
return int(x) <= int(y)
case uint64:
return int(x) <= int(y)
case int:
return int(x) <= int(y)
case int8:
return int(x) <= int(y)
case int16:
return int(x) <= int(y)
case int32:
return int(x) <= int(y)
case int64:
return int(x) <= int(y)
case float32:
return float64(x) <= float64(y)
case float64:
return float64(x) <= float64(y)
}
case int32:
switch y := b.(type) {
case uint:
return int(x) <= int(y)
case uint8:
return int(x) <= int(y)
case uint16:
return int(x) <= int(y)
case uint32:
return int(x) <= int(y)
case uint64:
return int(x) <= int(y)
case int:
return int(x) <= int(y)
case int8:
return int(x) <= int(y)
case int16:
return int(x) <= int(y)
case int32:
return int(x) <= int(y)
case int64:
return int(x) <= int(y)
case float32:
return float64(x) <= float64(y)
case float64:
return float64(x) <= float64(y)
}
case int64:
switch y := b.(type) {
case uint:
return int(x) <= int(y)
case uint8:
return int(x) <= int(y)
case uint16:
return int(x) <= int(y)
case uint32:
return int(x) <= int(y)
case uint64:
return int(x) <= int(y)
case int:
return int(x) <= int(y)
case int8:
return int(x) <= int(y)
case int16:
return int(x) <= int(y)
case int32:
return int(x) <= int(y)
case int64:
return int(x) <= int(y)
case float32:
return float64(x) <= float64(y)
case float64:
return float64(x) <= float64(y)
}
case float32:
switch y := b.(type) {
case uint:
return float64(x) <= float64(y)
case uint8:
return float64(x) <= float64(y)
case uint16:
return float64(x) <= float64(y)
case uint32:
return float64(x) <= float64(y)
case uint64:
return float64(x) <= float64(y)
case int:
return float64(x) <= float64(y)
case int8:
return float64(x) <= float64(y)
case int16:
return float64(x) <= float64(y)
case int32:
return float64(x) <= float64(y)
case int64:
return float64(x) <= float64(y)
case float32:
return float64(x) <= float64(y)
case float64:
return float64(x) <= float64(y)
}
case float64:
switch y := b.(type) {
case uint:
return float64(x) <= float64(y)
case uint8:
return float64(x) <= float64(y)
case uint16:
return float64(x) <= float64(y)
case uint32:
return float64(x) <= float64(y)
case uint64:
return float64(x) <= float64(y)
case int:
return float64(x) <= float64(y)
case int8:
return float64(x) <= float64(y)
case int16:
return float64(x) <= float64(y)
case int32:
return float64(x) <= float64(y)
case int64:
return float64(x) <= float64(y)
case float32:
return float64(x) <= float64(y)
case float64:
return float64(x) <= float64(y)
}
case string:
switch y := b.(type) {
case string:
return x <= y
}
case time.Time:
switch y := b.(type) {
case time.Time:
return x.Before(y) || x.Equal(y)
}
case time.Duration:
switch y := b.(type) {
case time.Duration:
return x <= y
}
}
panic(fmt.Sprintf("invalid operation: %T <= %T", a, b))
}
func MoreOrEqual(a, b interface{}) bool {
switch x := a.(type) {
case uint:
switch y := b.(type) {
case uint:
return int(x) >= int(y)
case uint8:
return int(x) >= int(y)
case uint16:
return int(x) >= int(y)
case uint32:
return int(x) >= int(y)
case uint64:
return int(x) >= int(y)
case int:
return int(x) >= int(y)
case int8:
return int(x) >= int(y)
case int16:
return int(x) >= int(y)
case int32:
return int(x) >= int(y)
case int64:
return int(x) >= int(y)
case float32:
return float64(x) >= float64(y)
case float64:
return float64(x) >= float64(y)
}
case uint8:
switch y := b.(type) {
case uint:
return int(x) >= int(y)
case uint8:
return int(x) >= int(y)
case uint16:
return int(x) >= int(y)
case uint32:
return int(x) >= int(y)
case uint64:
return int(x) >= int(y)
case int:
return int(x) >= int(y)
case int8:
return int(x) >= int(y)
case int16:
return int(x) >= int(y)
case int32:
return int(x) >= int(y)
case int64:
return int(x) >= int(y)
case float32:
return float64(x) >= float64(y)
case float64:
return float64(x) >= float64(y)
}
case uint16:
switch y := b.(type) {
case uint:
return int(x) >= int(y)
case uint8:
return int(x) >= int(y)
case uint16:
return int(x) >= int(y)
case uint32:
return int(x) >= int(y)
case uint64:
return int(x) >= int(y)
case int:
return int(x) >= int(y)
case int8:
return int(x) >= int(y)
case int16:
return int(x) >= int(y)
case int32:
return int(x) >= int(y)
case int64:
return int(x) >= int(y)
case float32:
return float64(x) >= float64(y)
case float64:
return float64(x) >= float64(y)
}
case uint32:
switch y := b.(type) {
case uint:
return int(x) >= int(y)
case uint8:
return int(x) >= int(y)
case uint16:
return int(x) >= int(y)
case uint32:
return int(x) >= int(y)
case uint64:
return int(x) >= int(y)
case int:
return int(x) >= int(y)
case int8:
return int(x) >= int(y)
case int16:
return int(x) >= int(y)
case int32:
return int(x) >= int(y)
case int64:
return int(x) >= int(y)
case float32:
return float64(x) >= float64(y)
case float64:
return float64(x) >= float64(y)
}
case uint64:
switch y := b.(type) {
case uint:
return int(x) >= int(y)
case uint8:
return int(x) >= int(y)
case uint16:
return int(x) >= int(y)
case uint32:
return int(x) >= int(y)
case uint64:
return int(x) >= int(y)
case int:
return int(x) >= int(y)
case int8:
return int(x) >= int(y)
case int16:
return int(x) >= int(y)
case int32:
return int(x) >= int(y)
case int64:
return int(x) >= int(y)
case float32:
return float64(x) >= float64(y)
case float64:
return float64(x) >= float64(y)
}
case int:
switch y := b.(type) {
case uint:
return int(x) >= int(y)
case uint8:
return int(x) >= int(y)
case uint16:
return int(x) >= int(y)
case uint32:
return int(x) >= int(y)
case uint64:
return int(x) >= int(y)
case int:
return int(x) >= int(y)
case int8:
return int(x) >= int(y)
case int16:
return int(x) >= int(y)
case int32:
return int(x) >= int(y)
case int64:
return int(x) >= int(y)
case float32:
return float64(x) >= float64(y)
case float64:
return float64(x) >= float64(y)
}
case int8:
switch y := b.(type) {
case uint:
return int(x) >= int(y)
case uint8:
return int(x) >= int(y)
case uint16:
return int(x) >= int(y)
case uint32:
return int(x) >= int(y)
case uint64:
return int(x) >= int(y)
case int:
return int(x) >= int(y)
case int8:
return int(x) >= int(y)
case int16:
return int(x) >= int(y)
case int32:
return int(x) >= int(y)
case int64:
return int(x) >= int(y)
case float32:
return float64(x) >= float64(y)
case float64:
return float64(x) >= float64(y)
}
case int16:
switch y := b.(type) {
case uint:
return int(x) >= int(y)
case uint8:
return int(x) >= int(y)
case uint16:
return int(x) >= int(y)
case uint32:
return int(x) >= int(y)
case uint64:
return int(x) >= int(y)
case int:
return int(x) >= int(y)
case int8:
return int(x) >= int(y)
case int16:
return int(x) >= int(y)
case int32:
return int(x) >= int(y)
case int64:
return int(x) >= int(y)
case float32:
return float64(x) >= float64(y)
case float64:
return float64(x) >= float64(y)
}
case int32:
switch y := b.(type) {
case uint:
return int(x) >= int(y)
case uint8:
return int(x) >= int(y)
case uint16:
return int(x) >= int(y)
case uint32:
return int(x) >= int(y)
case uint64:
return int(x) >= int(y)
case int:
return int(x) >= int(y)
case int8:
return int(x) >= int(y)
case int16:
return int(x) >= int(y)
case int32:
return int(x) >= int(y)
case int64:
return int(x) >= int(y)
case float32:
return float64(x) >= float64(y)
case float64:
return float64(x) >= float64(y)
}
case int64:
switch y := b.(type) {
case uint:
return int(x) >= int(y)
case uint8:
return int(x) >= int(y)
case uint16:
return int(x) >= int(y)
case uint32:
return int(x) >= int(y)
case uint64:
return int(x) >= int(y)
case int:
return int(x) >= int(y)
case int8:
return int(x) >= int(y)
case int16:
return int(x) >= int(y)
case int32:
return int(x) >= int(y)
case int64:
return int(x) >= int(y)
case float32:
return float64(x) >= float64(y)
case float64:
return float64(x) >= float64(y)
}
case float32:
switch y := b.(type) {
case uint:
return float64(x) >= float64(y)
case uint8:
return float64(x) >= float64(y)
case uint16:
return float64(x) >= float64(y)
case uint32:
return float64(x) >= float64(y)
case uint64:
return float64(x) >= float64(y)
case int:
return float64(x) >= float64(y)
case int8:
return float64(x) >= float64(y)
case int16:
return float64(x) >= float64(y)
case int32:
return float64(x) >= float64(y)
case int64:
return float64(x) >= float64(y)
case float32:
return float64(x) >= float64(y)
case float64:
return float64(x) >= float64(y)
}
case float64:
switch y := b.(type) {
case uint:
return float64(x) >= float64(y)
case uint8:
return float64(x) >= float64(y)
case uint16:
return float64(x) >= float64(y)
case uint32:
return float64(x) >= float64(y)
case uint64:
return float64(x) >= float64(y)
case int:
return float64(x) >= float64(y)
case int8:
return float64(x) >= float64(y)
case int16:
return float64(x) >= float64(y)
case int32:
return float64(x) >= float64(y)
case int64:
return float64(x) >= float64(y)
case float32:
return float64(x) >= float64(y)
case float64:
return float64(x) >= float64(y)
}
case string:
switch y := b.(type) {
case string:
return x >= y
}
case time.Time:
switch y := b.(type) {
case time.Time:
return x.After(y) || x.Equal(y)
}
case time.Duration:
switch y := b.(type) {
case time.Duration:
return x >= y
}
}
panic(fmt.Sprintf("invalid operation: %T >= %T", a, b))
}
func Add(a, b interface{}) interface{} {
switch x := a.(type) {
case uint:
switch y := b.(type) {
case uint:
return int(x) + int(y)
case uint8:
return int(x) + int(y)
case uint16:
return int(x) + int(y)
case uint32:
return int(x) + int(y)
case uint64:
return int(x) + int(y)
case int:
return int(x) + int(y)
case int8:
return int(x) + int(y)
case int16:
return int(x) + int(y)
case int32:
return int(x) + int(y)
case int64:
return int(x) + int(y)
case float32:
return float64(x) + float64(y)
case float64:
return float64(x) + float64(y)
}
case uint8:
switch y := b.(type) {
case uint:
return int(x) + int(y)
case uint8:
return int(x) + int(y)
case uint16:
return int(x) + int(y)
case uint32:
return int(x) + int(y)
case uint64:
return int(x) + int(y)
case int:
return int(x) + int(y)
case int8:
return int(x) + int(y)
case int16:
return int(x) + int(y)
case int32:
return int(x) + int(y)
case int64:
return int(x) + int(y)
case float32:
return float64(x) + float64(y)
case float64:
return float64(x) + float64(y)
}
case uint16:
switch y := b.(type) {
case uint:
return int(x) + int(y)
case uint8:
return int(x) + int(y)
case uint16:
return int(x) + int(y)
case uint32:
return int(x) + int(y)
case uint64:
return int(x) + int(y)
case int:
return int(x) + int(y)
case int8:
return int(x) + int(y)
case int16:
return int(x) + int(y)
case int32:
return int(x) + int(y)
case int64:
return int(x) + int(y)
case float32:
return float64(x) + float64(y)
case float64:
return float64(x) + float64(y)
}
case uint32:
switch y := b.(type) {
case uint:
return int(x) + int(y)
case uint8:
return int(x) + int(y)
case uint16:
return int(x) + int(y)
case uint32:
return int(x) + int(y)
case uint64:
return int(x) + int(y)
case int:
return int(x) + int(y)
case int8:
return int(x) + int(y)
case int16:
return int(x) + int(y)
case int32:
return int(x) + int(y)
case int64:
return int(x) + int(y)
case float32:
return float64(x) + float64(y)
case float64:
return float64(x) + float64(y)
}
case uint64:
switch y := b.(type) {
case uint:
return int(x) + int(y)
case uint8:
return int(x) + int(y)
case uint16:
return int(x) + int(y)
case uint32:
return int(x) + int(y)
case uint64:
return int(x) + int(y)
case int:
return int(x) + int(y)
case int8:
return int(x) + int(y)
case int16:
return int(x) + int(y)
case int32:
return int(x) + int(y)
case int64:
return int(x) + int(y)
case float32:
return float64(x) + float64(y)
case float64:
return float64(x) + float64(y)
}
case int:
switch y := b.(type) {
case uint:
return int(x) + int(y)
case uint8:
return int(x) + int(y)
case uint16:
return int(x) + int(y)
case uint32:
return int(x) + int(y)
case uint64:
return int(x) + int(y)
case int:
return int(x) + int(y)
case int8:
return int(x) + int(y)
case int16:
return int(x) + int(y)
case int32:
return int(x) + int(y)
case int64:
return int(x) + int(y)
case float32:
return float64(x) + float64(y)
case float64:
return float64(x) + float64(y)
}
case int8:
switch y := b.(type) {
case uint:
return int(x) + int(y)
case uint8:
return int(x) + int(y)
case uint16:
return int(x) + int(y)
case uint32:
return int(x) + int(y)
case uint64:
return int(x) + int(y)
case int:
return int(x) + int(y)
case int8:
return int(x) + int(y)
case int16:
return int(x) + int(y)
case int32:
return int(x) + int(y)
case int64:
return int(x) + int(y)
case float32:
return float64(x) + float64(y)
case float64:
return float64(x) + float64(y)
}
case int16:
switch y := b.(type) {
case uint:
return int(x) + int(y)
case uint8:
return int(x) + int(y)
case uint16:
return int(x) + int(y)
case uint32:
return int(x) + int(y)
case uint64:
return int(x) + int(y)
case int:
return int(x) + int(y)
case int8:
return int(x) + int(y)
case int16:
return int(x) + int(y)
case int32:
return int(x) + int(y)
case int64:
return int(x) + int(y)
case float32:
return float64(x) + float64(y)
case float64:
return float64(x) + float64(y)
}
case int32:
switch y := b.(type) {
case uint:
return int(x) + int(y)
case uint8:
return int(x) + int(y)
case uint16:
return int(x) + int(y)
case uint32:
return int(x) + int(y)
case uint64:
return int(x) + int(y)
case int:
return int(x) + int(y)
case int8:
return int(x) + int(y)
case int16:
return int(x) + int(y)
case int32:
return int(x) + int(y)
case int64:
return int(x) + int(y)
case float32:
return float64(x) + float64(y)
case float64:
return float64(x) + float64(y)
}
case int64:
switch y := b.(type) {
case uint:
return int(x) + int(y)
case uint8:
return int(x) + int(y)
case uint16:
return int(x) + int(y)
case uint32:
return int(x) + int(y)
case uint64:
return int(x) + int(y)
case int:
return int(x) + int(y)
case int8:
return int(x) + int(y)
case int16:
return int(x) + int(y)
case int32:
return int(x) + int(y)
case int64:
return int(x) + int(y)
case float32:
return float64(x) + float64(y)
case float64:
return float64(x) + float64(y)
}
case float32:
switch y := b.(type) {
case uint:
return float64(x) + float64(y)
case uint8:
return float64(x) + float64(y)
case uint16:
return float64(x) + float64(y)
case uint32:
return float64(x) + float64(y)
case uint64:
return float64(x) + float64(y)
case int:
return float64(x) + float64(y)
case int8:
return float64(x) + float64(y)
case int16:
return float64(x) + float64(y)
case int32:
return float64(x) + float64(y)
case int64:
return float64(x) + float64(y)
case float32:
return float64(x) + float64(y)
case float64:
return float64(x) + float64(y)
}
case float64:
switch y := b.(type) {
case uint:
return float64(x) + float64(y)
case uint8:
return float64(x) + float64(y)
case uint16:
return float64(x) + float64(y)
case uint32:
return float64(x) + float64(y)
case uint64:
return float64(x) + float64(y)
case int:
return float64(x) + float64(y)
case int8:
return float64(x) + float64(y)
case int16:
return float64(x) + float64(y)
case int32:
return float64(x) + float64(y)
case int64:
return float64(x) + float64(y)
case float32:
return float64(x) + float64(y)
case float64:
return float64(x) + float64(y)
}
case string:
switch y := b.(type) {
case string:
return x + y
}
case time.Time:
switch y := b.(type) {
case time.Duration:
return x.Add(y)
}
case time.Duration:
switch y := b.(type) {
case time.Time:
return y.Add(x)
case time.Duration:
return x + y
}
}
panic(fmt.Sprintf("invalid operation: %T + %T", a, b))
}
func Subtract(a, b interface{}) interface{} {
switch x := a.(type) {
case uint:
switch y := b.(type) {
case uint:
return int(x) - int(y)
case uint8:
return int(x) - int(y)
case uint16:
return int(x) - int(y)
case uint32:
return int(x) - int(y)
case uint64:
return int(x) - int(y)
case int:
return int(x) - int(y)
case int8:
return int(x) - int(y)
case int16:
return int(x) - int(y)
case int32:
return int(x) - int(y)
case int64:
return int(x) - int(y)
case float32:
return float64(x) - float64(y)
case float64:
return float64(x) - float64(y)
}
case uint8:
switch y := b.(type) {
case uint:
return int(x) - int(y)
case uint8:
return int(x) - int(y)
case uint16:
return int(x) - int(y)
case uint32:
return int(x) - int(y)
case uint64:
return int(x) - int(y)
case int:
return int(x) - int(y)
case int8:
return int(x) - int(y)
case int16:
return int(x) - int(y)
case int32:
return int(x) - int(y)
case int64:
return int(x) - int(y)
case float32:
return float64(x) - float64(y)
case float64:
return float64(x) - float64(y)
}
case uint16:
switch y := b.(type) {
case uint:
return int(x) - int(y)
case uint8:
return int(x) - int(y)
case uint16:
return int(x) - int(y)
case uint32:
return int(x) - int(y)
case uint64:
return int(x) - int(y)
case int:
return int(x) - int(y)
case int8:
return int(x) - int(y)
case int16:
return int(x) - int(y)
case int32:
return int(x) - int(y)
case int64:
return int(x) - int(y)
case float32:
return float64(x) - float64(y)
case float64:
return float64(x) - float64(y)
}
case uint32:
switch y := b.(type) {
case uint:
return int(x) - int(y)
case uint8:
return int(x) - int(y)
case uint16:
return int(x) - int(y)
case uint32:
return int(x) - int(y)
case uint64:
return int(x) - int(y)
case int:
return int(x) - int(y)
case int8:
return int(x) - int(y)
case int16:
return int(x) - int(y)
case int32:
return int(x) - int(y)
case int64:
return int(x) - int(y)
case float32:
return float64(x) - float64(y)
case float64:
return float64(x) - float64(y)
}
case uint64:
switch y := b.(type) {
case uint:
return int(x) - int(y)
case uint8:
return int(x) - int(y)
case uint16:
return int(x) - int(y)
case uint32:
return int(x) - int(y)
case uint64:
return int(x) - int(y)
case int:
return int(x) - int(y)
case int8:
return int(x) - int(y)
case int16:
return int(x) - int(y)
case int32:
return int(x) - int(y)
case int64:
return int(x) - int(y)
case float32:
return float64(x) - float64(y)
case float64:
return float64(x) - float64(y)
}
case int:
switch y := b.(type) {
case uint:
return int(x) - int(y)
case uint8:
return int(x) - int(y)
case uint16:
return int(x) - int(y)
case uint32:
return int(x) - int(y)
case uint64:
return int(x) - int(y)
case int:
return int(x) - int(y)
case int8:
return int(x) - int(y)
case int16:
return int(x) - int(y)
case int32:
return int(x) - int(y)
case int64:
return int(x) - int(y)
case float32:
return float64(x) - float64(y)
case float64:
return float64(x) - float64(y)
}
case int8:
switch y := b.(type) {
case uint:
return int(x) - int(y)
case uint8:
return int(x) - int(y)
case uint16:
return int(x) - int(y)
case uint32:
return int(x) - int(y)
case uint64:
return int(x) - int(y)
case int:
return int(x) - int(y)
case int8:
return int(x) - int(y)
case int16:
return int(x) - int(y)
case int32:
return int(x) - int(y)
case int64:
return int(x) - int(y)
case float32:
return float64(x) - float64(y)
case float64:
return float64(x) - float64(y)
}
case int16:
switch y := b.(type) {
case uint:
return int(x) - int(y)
case uint8:
return int(x) - int(y)
case uint16:
return int(x) - int(y)
case uint32:
return int(x) - int(y)
case uint64:
return int(x) - int(y)
case int:
return int(x) - int(y)
case int8:
return int(x) - int(y)
case int16:
return int(x) - int(y)
case int32:
return int(x) - int(y)
case int64:
return int(x) - int(y)
case float32:
return float64(x) - float64(y)
case float64:
return float64(x) - float64(y)
}
case int32:
switch y := b.(type) {
case uint:
return int(x) - int(y)
case uint8:
return int(x) - int(y)
case uint16:
return int(x) - int(y)
case uint32:
return int(x) - int(y)
case uint64:
return int(x) - int(y)
case int:
return int(x) - int(y)
case int8:
return int(x) - int(y)
case int16:
return int(x) - int(y)
case int32:
return int(x) - int(y)
case int64:
return int(x) - int(y)
case float32:
return float64(x) - float64(y)
case float64:
return float64(x) - float64(y)
}
case int64:
switch y := b.(type) {
case uint:
return int(x) - int(y)
case uint8:
return int(x) - int(y)
case uint16:
return int(x) - int(y)
case uint32:
return int(x) - int(y)
case uint64:
return int(x) - int(y)
case int:
return int(x) - int(y)
case int8:
return int(x) - int(y)
case int16:
return int(x) - int(y)
case int32:
return int(x) - int(y)
case int64:
return int(x) - int(y)
case float32:
return float64(x) - float64(y)
case float64:
return float64(x) - float64(y)
}
case float32:
switch y := b.(type) {
case uint:
return float64(x) - float64(y)
case uint8:
return float64(x) - float64(y)
case uint16:
return float64(x) - float64(y)
case uint32:
return float64(x) - float64(y)
case uint64:
return float64(x) - float64(y)
case int:
return float64(x) - float64(y)
case int8:
return float64(x) - float64(y)
case int16:
return float64(x) - float64(y)
case int32:
return float64(x) - float64(y)
case int64:
return float64(x) - float64(y)
case float32:
return float64(x) - float64(y)
case float64:
return float64(x) - float64(y)
}
case float64:
switch y := b.(type) {
case uint:
return float64(x) - float64(y)
case uint8:
return float64(x) - float64(y)
case uint16:
return float64(x) - float64(y)
case uint32:
return float64(x) - float64(y)
case uint64:
return float64(x) - float64(y)
case int:
return float64(x) - float64(y)
case int8:
return float64(x) - float64(y)
case int16:
return float64(x) - float64(y)
case int32:
return float64(x) - float64(y)
case int64:
return float64(x) - float64(y)
case float32:
return float64(x) - float64(y)
case float64:
return float64(x) - float64(y)
}
case time.Time:
switch y := b.(type) {
case time.Time:
return x.Sub(y)
case time.Duration:
return x.Add(-y)
}
case time.Duration:
switch y := b.(type) {
case time.Duration:
return x - y
}
}
panic(fmt.Sprintf("invalid operation: %T - %T", a, b))
}
func Multiply(a, b interface{}) interface{} {
switch x := a.(type) {
case uint:
switch y := b.(type) {
case uint:
return int(x) * int(y)
case uint8:
return int(x) * int(y)
case uint16:
return int(x) * int(y)
case uint32:
return int(x) * int(y)
case uint64:
return int(x) * int(y)
case int:
return int(x) * int(y)
case int8:
return int(x) * int(y)
case int16:
return int(x) * int(y)
case int32:
return int(x) * int(y)
case int64:
return int(x) * int(y)
case float32:
return float64(x) * float64(y)
case float64:
return float64(x) * float64(y)
case time.Duration:
return time.Duration(x) * time.Duration(y)
}
case uint8:
switch y := b.(type) {
case uint:
return int(x) * int(y)
case uint8:
return int(x) * int(y)
case uint16:
return int(x) * int(y)
case uint32:
return int(x) * int(y)
case uint64:
return int(x) * int(y)
case int:
return int(x) * int(y)
case int8:
return int(x) * int(y)
case int16:
return int(x) * int(y)
case int32:
return int(x) * int(y)
case int64:
return int(x) * int(y)
case float32:
return float64(x) * float64(y)
case float64:
return float64(x) * float64(y)
case time.Duration:
return time.Duration(x) * time.Duration(y)
}
case uint16:
switch y := b.(type) {
case uint:
return int(x) * int(y)
case uint8:
return int(x) * int(y)
case uint16:
return int(x) * int(y)
case uint32:
return int(x) * int(y)
case uint64:
return int(x) * int(y)
case int:
return int(x) * int(y)
case int8:
return int(x) * int(y)
case int16:
return int(x) * int(y)
case int32:
return int(x) * int(y)
case int64:
return int(x) * int(y)
case float32:
return float64(x) * float64(y)
case float64:
return float64(x) * float64(y)
case time.Duration:
return time.Duration(x) * time.Duration(y)
}
case uint32:
switch y := b.(type) {
case uint:
return int(x) * int(y)
case uint8:
return int(x) * int(y)
case uint16:
return int(x) * int(y)
case uint32:
return int(x) * int(y)
case uint64:
return int(x) * int(y)
case int:
return int(x) * int(y)
case int8:
return int(x) * int(y)
case int16:
return int(x) * int(y)
case int32:
return int(x) * int(y)
case int64:
return int(x) * int(y)
case float32:
return float64(x) * float64(y)
case float64:
return float64(x) * float64(y)
case time.Duration:
return time.Duration(x) * time.Duration(y)
}
case uint64:
switch y := b.(type) {
case uint:
return int(x) * int(y)
case uint8:
return int(x) * int(y)
case uint16:
return int(x) * int(y)
case uint32:
return int(x) * int(y)
case uint64:
return int(x) * int(y)
case int:
return int(x) * int(y)
case int8:
return int(x) * int(y)
case int16:
return int(x) * int(y)
case int32:
return int(x) * int(y)
case int64:
return int(x) * int(y)
case float32:
return float64(x) * float64(y)
case float64:
return float64(x) * float64(y)
case time.Duration:
return time.Duration(x) * time.Duration(y)
}
case int:
switch y := b.(type) {
case uint:
return int(x) * int(y)
case uint8:
return int(x) * int(y)
case uint16:
return int(x) * int(y)
case uint32:
return int(x) * int(y)
case uint64:
return int(x) * int(y)
case int:
return int(x) * int(y)
case int8:
return int(x) * int(y)
case int16:
return int(x) * int(y)
case int32:
return int(x) * int(y)
case int64:
return int(x) * int(y)
case float32:
return float64(x) * float64(y)
case float64:
return float64(x) * float64(y)
case time.Duration:
return time.Duration(x) * time.Duration(y)
}
case int8:
switch y := b.(type) {
case uint:
return int(x) * int(y)
case uint8:
return int(x) * int(y)
case uint16:
return int(x) * int(y)
case uint32:
return int(x) * int(y)
case uint64:
return int(x) * int(y)
case int:
return int(x) * int(y)
case int8:
return int(x) * int(y)
case int16:
return int(x) * int(y)
case int32:
return int(x) * int(y)
case int64:
return int(x) * int(y)
case float32:
return float64(x) * float64(y)
case float64:
return float64(x) * float64(y)
case time.Duration:
return time.Duration(x) * time.Duration(y)
}
case int16:
switch y := b.(type) {
case uint:
return int(x) * int(y)
case uint8:
return int(x) * int(y)
case uint16:
return int(x) * int(y)
case uint32:
return int(x) * int(y)
case uint64:
return int(x) * int(y)
case int:
return int(x) * int(y)
case int8:
return int(x) * int(y)
case int16:
return int(x) * int(y)
case int32:
return int(x) * int(y)
case int64:
return int(x) * int(y)
case float32:
return float64(x) * float64(y)
case float64:
return float64(x) * float64(y)
case time.Duration:
return time.Duration(x) * time.Duration(y)
}
case int32:
switch y := b.(type) {
case uint:
return int(x) * int(y)
case uint8:
return int(x) * int(y)
case uint16:
return int(x) * int(y)
case uint32:
return int(x) * int(y)
case uint64:
return int(x) * int(y)
case int:
return int(x) * int(y)
case int8:
return int(x) * int(y)
case int16:
return int(x) * int(y)
case int32:
return int(x) * int(y)
case int64:
return int(x) * int(y)
case float32:
return float64(x) * float64(y)
case float64:
return float64(x) * float64(y)
case time.Duration:
return time.Duration(x) * time.Duration(y)
}
case int64:
switch y := b.(type) {
case uint:
return int(x) * int(y)
case uint8:
return int(x) * int(y)
case uint16:
return int(x) * int(y)
case uint32:
return int(x) * int(y)
case uint64:
return int(x) * int(y)
case int:
return int(x) * int(y)
case int8:
return int(x) * int(y)
case int16:
return int(x) * int(y)
case int32:
return int(x) * int(y)
case int64:
return int(x) * int(y)
case float32:
return float64(x) * float64(y)
case float64:
return float64(x) * float64(y)
case time.Duration:
return time.Duration(x) * time.Duration(y)
}
case float32:
switch y := b.(type) {
case uint:
return float64(x) * float64(y)
case uint8:
return float64(x) * float64(y)
case uint16:
return float64(x) * float64(y)
case uint32:
return float64(x) * float64(y)
case uint64:
return float64(x) * float64(y)
case int:
return float64(x) * float64(y)
case int8:
return float64(x) * float64(y)
case int16:
return float64(x) * float64(y)
case int32:
return float64(x) * float64(y)
case int64:
return float64(x) * float64(y)
case float32:
return float64(x) * float64(y)
case float64:
return float64(x) * float64(y)
case time.Duration:
return float64(x) * float64(y)
}
case float64:
switch y := b.(type) {
case uint:
return float64(x) * float64(y)
case uint8:
return float64(x) * float64(y)
case uint16:
return float64(x) * float64(y)
case uint32:
return float64(x) * float64(y)
case uint64:
return float64(x) * float64(y)
case int:
return float64(x) * float64(y)
case int8:
return float64(x) * float64(y)
case int16:
return float64(x) * float64(y)
case int32:
return float64(x) * float64(y)
case int64:
return float64(x) * float64(y)
case float32:
return float64(x) * float64(y)
case float64:
return float64(x) * float64(y)
case time.Duration:
return float64(x) * float64(y)
}
case time.Duration:
switch y := b.(type) {
case uint:
return time.Duration(x) * time.Duration(y)
case uint8:
return time.Duration(x) * time.Duration(y)
case uint16:
return time.Duration(x) * time.Duration(y)
case uint32:
return time.Duration(x) * time.Duration(y)
case uint64:
return time.Duration(x) * time.Duration(y)
case int:
return time.Duration(x) * time.Duration(y)
case int8:
return time.Duration(x) * time.Duration(y)
case int16:
return time.Duration(x) * time.Duration(y)
case int32:
return time.Duration(x) * time.Duration(y)
case int64:
return time.Duration(x) * time.Duration(y)
case float32:
return float64(x) * float64(y)
case float64:
return float64(x) * float64(y)
case time.Duration:
return time.Duration(x) * time.Duration(y)
}
}
panic(fmt.Sprintf("invalid operation: %T * %T", a, b))
}
func Divide(a, b interface{}) float64 {
switch x := a.(type) {
case uint:
switch y := b.(type) {
case uint:
return float64(x) / float64(y)
case uint8:
return float64(x) / float64(y)
case uint16:
return float64(x) / float64(y)
case uint32:
return float64(x) / float64(y)
case uint64:
return float64(x) / float64(y)
case int:
return float64(x) / float64(y)
case int8:
return float64(x) / float64(y)
case int16:
return float64(x) / float64(y)
case int32:
return float64(x) / float64(y)
case int64:
return float64(x) / float64(y)
case float32:
return float64(x) / float64(y)
case float64:
return float64(x) / float64(y)
}
case uint8:
switch y := b.(type) {
case uint:
return float64(x) / float64(y)
case uint8:
return float64(x) / float64(y)
case uint16:
return float64(x) / float64(y)
case uint32:
return float64(x) / float64(y)
case uint64:
return float64(x) / float64(y)
case int:
return float64(x) / float64(y)
case int8:
return float64(x) / float64(y)
case int16:
return float64(x) / float64(y)
case int32:
return float64(x) / float64(y)
case int64:
return float64(x) / float64(y)
case float32:
return float64(x) / float64(y)
case float64:
return float64(x) / float64(y)
}
case uint16:
switch y := b.(type) {
case uint:
return float64(x) / float64(y)
case uint8:
return float64(x) / float64(y)
case uint16:
return float64(x) / float64(y)
case uint32:
return float64(x) / float64(y)
case uint64:
return float64(x) / float64(y)
case int:
return float64(x) / float64(y)
case int8:
return float64(x) / float64(y)
case int16:
return float64(x) / float64(y)
case int32:
return float64(x) / float64(y)
case int64:
return float64(x) / float64(y)
case float32:
return float64(x) / float64(y)
case float64:
return float64(x) / float64(y)
}
case uint32:
switch y := b.(type) {
case uint:
return float64(x) / float64(y)
case uint8:
return float64(x) / float64(y)
case uint16:
return float64(x) / float64(y)
case uint32:
return float64(x) / float64(y)
case uint64:
return float64(x) / float64(y)
case int:
return float64(x) / float64(y)
case int8:
return float64(x) / float64(y)
case int16:
return float64(x) / float64(y)
case int32:
return float64(x) / float64(y)
case int64:
return float64(x) / float64(y)
case float32:
return float64(x) / float64(y)
case float64:
return float64(x) / float64(y)
}
case uint64:
switch y := b.(type) {
case uint:
return float64(x) / float64(y)
case uint8:
return float64(x) / float64(y)
case uint16:
return float64(x) / float64(y)
case uint32:
return float64(x) / float64(y)
case uint64:
return float64(x) / float64(y)
case int:
return float64(x) / float64(y)
case int8:
return float64(x) / float64(y)
case int16:
return float64(x) / float64(y)
case int32:
return float64(x) / float64(y)
case int64:
return float64(x) / float64(y)
case float32:
return float64(x) / float64(y)
case float64:
return float64(x) / float64(y)
}
case int:
switch y := b.(type) {
case uint:
return float64(x) / float64(y)
case uint8:
return float64(x) / float64(y)
case uint16:
return float64(x) / float64(y)
case uint32:
return float64(x) / float64(y)
case uint64:
return float64(x) / float64(y)
case int:
return float64(x) / float64(y)
case int8:
return float64(x) / float64(y)
case int16:
return float64(x) / float64(y)
case int32:
return float64(x) / float64(y)
case int64:
return float64(x) / float64(y)
case float32:
return float64(x) / float64(y)
case float64:
return float64(x) / float64(y)
}
case int8:
switch y := b.(type) {
case uint:
return float64(x) / float64(y)
case uint8:
return float64(x) / float64(y)
case uint16:
return float64(x) / float64(y)
case uint32:
return float64(x) / float64(y)
case uint64:
return float64(x) / float64(y)
case int:
return float64(x) / float64(y)
case int8:
return float64(x) / float64(y)
case int16:
return float64(x) / float64(y)
case int32:
return float64(x) / float64(y)
case int64:
return float64(x) / float64(y)
case float32:
return float64(x) / float64(y)
case float64:
return float64(x) / float64(y)
}
case int16:
switch y := b.(type) {
case uint:
return float64(x) / float64(y)
case uint8:
return float64(x) / float64(y)
case uint16:
return float64(x) / float64(y)
case uint32:
return float64(x) / float64(y)
case uint64:
return float64(x) / float64(y)
case int:
return float64(x) / float64(y)
case int8:
return float64(x) / float64(y)
case int16:
return float64(x) / float64(y)
case int32:
return float64(x) / float64(y)
case int64:
return float64(x) / float64(y)
case float32:
return float64(x) / float64(y)
case float64:
return float64(x) / float64(y)
}
case int32:
switch y := b.(type) {
case uint:
return float64(x) / float64(y)
case uint8:
return float64(x) / float64(y)
case uint16:
return float64(x) / float64(y)
case uint32:
return float64(x) / float64(y)
case uint64:
return float64(x) / float64(y)
case int:
return float64(x) / float64(y)
case int8:
return float64(x) / float64(y)
case int16:
return float64(x) / float64(y)
case int32:
return float64(x) / float64(y)
case int64:
return float64(x) / float64(y)
case float32:
return float64(x) / float64(y)
case float64:
return float64(x) / float64(y)
}
case int64:
switch y := b.(type) {
case uint:
return float64(x) / float64(y)
case uint8:
return float64(x) / float64(y)
case uint16:
return float64(x) / float64(y)
case uint32:
return float64(x) / float64(y)
case uint64:
return float64(x) / float64(y)
case int:
return float64(x) / float64(y)
case int8:
return float64(x) / float64(y)
case int16:
return float64(x) / float64(y)
case int32:
return float64(x) / float64(y)
case int64:
return float64(x) / float64(y)
case float32:
return float64(x) / float64(y)
case float64:
return float64(x) / float64(y)
}
case float32:
switch y := b.(type) {
case uint:
return float64(x) / float64(y)
case uint8:
return float64(x) / float64(y)
case uint16:
return float64(x) / float64(y)
case uint32:
return float64(x) / float64(y)
case uint64:
return float64(x) / float64(y)
case int:
return float64(x) / float64(y)
case int8:
return float64(x) / float64(y)
case int16:
return float64(x) / float64(y)
case int32:
return float64(x) / float64(y)
case int64:
return float64(x) / float64(y)
case float32:
return float64(x) / float64(y)
case float64:
return float64(x) / float64(y)
}
case float64:
switch y := b.(type) {
case uint:
return float64(x) / float64(y)
case uint8:
return float64(x) / float64(y)
case uint16:
return float64(x) / float64(y)
case uint32:
return float64(x) / float64(y)
case uint64:
return float64(x) / float64(y)
case int:
return float64(x) / float64(y)
case int8:
return float64(x) / float64(y)
case int16:
return float64(x) / float64(y)
case int32:
return float64(x) / float64(y)
case int64:
return float64(x) / float64(y)
case float32:
return float64(x) / float64(y)
case float64:
return float64(x) / float64(y)
}
}
panic(fmt.Sprintf("invalid operation: %T / %T", a, b))
}
func Modulo(a, b interface{}) int {
switch x := a.(type) {
case uint:
switch y := b.(type) {
case uint:
return int(x) % int(y)
case uint8:
return int(x) % int(y)
case uint16:
return int(x) % int(y)
case uint32:
return int(x) % int(y)
case uint64:
return int(x) % int(y)
case int:
return int(x) % int(y)
case int8:
return int(x) % int(y)
case int16:
return int(x) % int(y)
case int32:
return int(x) % int(y)
case int64:
return int(x) % int(y)
}
case uint8:
switch y := b.(type) {
case uint:
return int(x) % int(y)
case uint8:
return int(x) % int(y)
case uint16:
return int(x) % int(y)
case uint32:
return int(x) % int(y)
case uint64:
return int(x) % int(y)
case int:
return int(x) % int(y)
case int8:
return int(x) % int(y)
case int16:
return int(x) % int(y)
case int32:
return int(x) % int(y)
case int64:
return int(x) % int(y)
}
case uint16:
switch y := b.(type) {
case uint:
return int(x) % int(y)
case uint8:
return int(x) % int(y)
case uint16:
return int(x) % int(y)
case uint32:
return int(x) % int(y)
case uint64:
return int(x) % int(y)
case int:
return int(x) % int(y)
case int8:
return int(x) % int(y)
case int16:
return int(x) % int(y)
case int32:
return int(x) % int(y)
case int64:
return int(x) % int(y)
}
case uint32:
switch y := b.(type) {
case uint:
return int(x) % int(y)
case uint8:
return int(x) % int(y)
case uint16:
return int(x) % int(y)
case uint32:
return int(x) % int(y)
case uint64:
return int(x) % int(y)
case int:
return int(x) % int(y)
case int8:
return int(x) % int(y)
case int16:
return int(x) % int(y)
case int32:
return int(x) % int(y)
case int64:
return int(x) % int(y)
}
case uint64:
switch y := b.(type) {
case uint:
return int(x) % int(y)
case uint8:
return int(x) % int(y)
case uint16:
return int(x) % int(y)
case uint32:
return int(x) % int(y)
case uint64:
return int(x) % int(y)
case int:
return int(x) % int(y)
case int8:
return int(x) % int(y)
case int16:
return int(x) % int(y)
case int32:
return int(x) % int(y)
case int64:
return int(x) % int(y)
}
case int:
switch y := b.(type) {
case uint:
return int(x) % int(y)
case uint8:
return int(x) % int(y)
case uint16:
return int(x) % int(y)
case uint32:
return int(x) % int(y)
case uint64:
return int(x) % int(y)
case int:
return int(x) % int(y)
case int8:
return int(x) % int(y)
case int16:
return int(x) % int(y)
case int32:
return int(x) % int(y)
case int64:
return int(x) % int(y)
}
case int8:
switch y := b.(type) {
case uint:
return int(x) % int(y)
case uint8:
return int(x) % int(y)
case uint16:
return int(x) % int(y)
case uint32:
return int(x) % int(y)
case uint64:
return int(x) % int(y)
case int:
return int(x) % int(y)
case int8:
return int(x) % int(y)
case int16:
return int(x) % int(y)
case int32:
return int(x) % int(y)
case int64:
return int(x) % int(y)
}
case int16:
switch y := b.(type) {
case uint:
return int(x) % int(y)
case uint8:
return int(x) % int(y)
case uint16:
return int(x) % int(y)
case uint32:
return int(x) % int(y)
case uint64:
return int(x) % int(y)
case int:
return int(x) % int(y)
case int8:
return int(x) % int(y)
case int16:
return int(x) % int(y)
case int32:
return int(x) % int(y)
case int64:
return int(x) % int(y)
}
case int32:
switch y := b.(type) {
case uint:
return int(x) % int(y)
case uint8:
return int(x) % int(y)
case uint16:
return int(x) % int(y)
case uint32:
return int(x) % int(y)
case uint64:
return int(x) % int(y)
case int:
return int(x) % int(y)
case int8:
return int(x) % int(y)
case int16:
return int(x) % int(y)
case int32:
return int(x) % int(y)
case int64:
return int(x) % int(y)
}
case int64:
switch y := b.(type) {
case uint:
return int(x) % int(y)
case uint8:
return int(x) % int(y)
case uint16:
return int(x) % int(y)
case uint32:
return int(x) % int(y)
case uint64:
return int(x) % int(y)
case int:
return int(x) % int(y)
case int8:
return int(x) % int(y)
case int16:
return int(x) % int(y)
case int32:
return int(x) % int(y)
case int64:
return int(x) % int(y)
}
}
panic(fmt.Sprintf("invalid operation: %T %% %T", a, b))
}