You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.1 KiB
Go
60 lines
1.1 KiB
Go
package ndef
|
|
|
|
// Int interface type
|
|
type Int interface {
|
|
~int | ~int8 | ~int16 | ~int32 | ~int64
|
|
}
|
|
|
|
// Uint interface type
|
|
type Uint interface {
|
|
~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
|
|
}
|
|
|
|
// XInt interface type. all int or uint types
|
|
type XInt interface {
|
|
Int | Uint
|
|
}
|
|
|
|
// Float interface type
|
|
type Float interface {
|
|
~float32 | ~float64
|
|
}
|
|
|
|
// IntOrFloat interface type. all int and float types
|
|
type IntOrFloat interface {
|
|
Int | Float
|
|
}
|
|
|
|
// XIntOrFloat interface type. all int, uint and float types
|
|
type XIntOrFloat interface {
|
|
Int | Uint | Float
|
|
}
|
|
|
|
// SortedType interface type.
|
|
// that supports the operators < <= >= >.
|
|
//
|
|
// contains: (x)int, float, ~string types
|
|
type SortedType interface {
|
|
Int | Uint | Float | ~string
|
|
}
|
|
|
|
// ScalarType interface type.
|
|
//
|
|
// contains: (x)int, float, ~string, ~bool types
|
|
type ScalarType interface {
|
|
Int | Uint | Float | ~string | ~bool
|
|
}
|
|
|
|
type ArgInt []int
|
|
|
|
// Get int by index from int slice
|
|
func (a ArgInt) Get(i int, args ...int) (r int) {
|
|
if i >= 0 && i < len(a) {
|
|
r = a[i]
|
|
}
|
|
if len(args) > 0 {
|
|
r = args[0]
|
|
}
|
|
return
|
|
}
|