Skip to content

Commit

Permalink
👔 up: math - rename the func CompIntOrFloat() to CompValue()
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Jun 4, 2023
1 parent c7af933 commit ba11691
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mathutil/check.go
Expand Up @@ -46,21 +46,21 @@ func Compare(srcVal, dstVal any, op string) (ok bool) {

// CompInt compare int,uint value. returns `srcVal op(=,!=,<,<=,>,>=) dstVal`
func CompInt[T comdef.Xint](srcVal, dstVal T, op string) (ok bool) {
return CompIntOrFloat(srcVal, dstVal, op)
return CompValue(srcVal, dstVal, op)
}

// CompInt64 compare int64 value. returns `srcVal op(=,!=,<,<=,>,>=) dstVal`
func CompInt64(srcVal, dstVal int64, op string) bool {
return CompIntOrFloat(srcVal, dstVal, op)
return CompValue(srcVal, dstVal, op)
}

// CompFloat compare float64,float32 value. returns `srcVal op(=,!=,<,<=,>,>=) dstVal`
func CompFloat[T comdef.Float](srcVal, dstVal T, op string) (ok bool) {
return CompIntOrFloat(srcVal, dstVal, op)
return CompValue(srcVal, dstVal, op)
}

// CompIntOrFloat compare intX,uintX,floatX value. returns `srcVal op(=,!=,<,<=,>,>=) dstVal`
func CompIntOrFloat[T comdef.XintOrFloat](srcVal, dstVal T, op string) (ok bool) {
// CompValue compare intX,uintX,floatX value. returns `srcVal op(=,!=,<,<=,>,>=) dstVal`
func CompValue[T comdef.XintOrFloat](srcVal, dstVal T, op string) (ok bool) {
switch op {
case "<", "lt":
ok = srcVal < dstVal
Expand Down

0 comments on commit ba11691

Please sign in to comment.