mirror of
https://github.com/astaxie/beego.git
synced 2024-11-27 03:41:28 +00:00
162 lines
1.8 KiB
Go
162 lines
1.8 KiB
Go
package num
|
|
|
|
func MinUint(a uint, b uint) uint {
|
|
if a > b {
|
|
return b
|
|
} else {
|
|
return a
|
|
}
|
|
}
|
|
|
|
func MaxUint(a uint, b uint) uint {
|
|
if a > b {
|
|
return a
|
|
} else {
|
|
return b
|
|
}
|
|
}
|
|
|
|
func MinInt(a int, b int) int {
|
|
if a > b {
|
|
return b
|
|
} else {
|
|
return a
|
|
}
|
|
}
|
|
|
|
func MaxInt(a int, b int) int {
|
|
if a > b {
|
|
return a
|
|
} else {
|
|
return b
|
|
}
|
|
}
|
|
|
|
func MinUint8(a uint8, b uint8) uint8 {
|
|
if a > b {
|
|
return b
|
|
} else {
|
|
return a
|
|
}
|
|
}
|
|
|
|
func MaxUint8(a uint8, b uint8) uint8 {
|
|
if a > b {
|
|
return a
|
|
} else {
|
|
return b
|
|
}
|
|
}
|
|
|
|
func MinInt8(a int8, b int8) int8 {
|
|
if a > b {
|
|
return b
|
|
} else {
|
|
return a
|
|
}
|
|
}
|
|
|
|
func MaxInt8(a int8, b int8) int8 {
|
|
if a > b {
|
|
return a
|
|
} else {
|
|
return b
|
|
}
|
|
}
|
|
|
|
func MinUint16(a uint16, b uint16) uint16 {
|
|
if a > b {
|
|
return b
|
|
} else {
|
|
return a
|
|
}
|
|
}
|
|
|
|
func MaxUint16(a uint16, b uint16) uint16 {
|
|
if a > b {
|
|
return a
|
|
} else {
|
|
return b
|
|
}
|
|
}
|
|
|
|
func MinInt16(a int16, b int16) int16 {
|
|
if a > b {
|
|
return b
|
|
} else {
|
|
return a
|
|
}
|
|
}
|
|
|
|
func MaxInt16(a int16, b int16) int16 {
|
|
if a > b {
|
|
return a
|
|
} else {
|
|
return b
|
|
}
|
|
}
|
|
|
|
func MinUint32(a uint32, b uint32) uint32 {
|
|
if a > b {
|
|
return b
|
|
} else {
|
|
return a
|
|
}
|
|
}
|
|
|
|
func MaxUint32(a uint32, b uint32) uint32 {
|
|
if a > b {
|
|
return a
|
|
} else {
|
|
return b
|
|
}
|
|
}
|
|
|
|
func MinInt32(a int32, b int32) int32 {
|
|
if a > b {
|
|
return b
|
|
} else {
|
|
return a
|
|
}
|
|
}
|
|
|
|
func MaxInt32(a int32, b int32) int32 {
|
|
if a > b {
|
|
return a
|
|
} else {
|
|
return b
|
|
}
|
|
}
|
|
|
|
func MinUint64(a uint64, b uint64) uint64 {
|
|
if a > b {
|
|
return b
|
|
} else {
|
|
return a
|
|
}
|
|
}
|
|
|
|
func MaxUint64(a uint64, b uint64) uint64 {
|
|
if a > b {
|
|
return a
|
|
} else {
|
|
return b
|
|
}
|
|
}
|
|
|
|
func MinInt64(a int64, b int64) int64 {
|
|
if a > b {
|
|
return b
|
|
} else {
|
|
return a
|
|
}
|
|
}
|
|
|
|
func MaxInt64(a int64, b int64) int64 {
|
|
if a > b {
|
|
return a
|
|
} else {
|
|
return b
|
|
}
|
|
}
|