Skip to content

Commit 564151b

Browse files
authored
*: use golang built-in functions rather than mathutil (pingcap#56818)
close pingcap#56594
1 parent 3532829 commit 564151b

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

goyacc/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ func main1(in string) (err error) {
361361
if k == 'r' {
362362
arg = -arg
363363
}
364-
minArg, maxArg = mathutil.Min(minArg, arg), mathutil.Max(maxArg, arg)
364+
minArg, maxArg = min(minArg, arg), max(maxArg, arg)
365365
}
366366
}
367367
su := make(symsUsed, 0, len(msu))
@@ -389,7 +389,7 @@ type %[1]sXError struct {
389389
for sym := range msu {
390390
nm := sym.Name
391391
if nm == "$default" || nm == "$end" || sym.IsTerminal && nm[0] != '\'' && sym.Value > 0 {
392-
maxTokName = mathutil.Max(maxTokName, len(nm))
392+
maxTokName = max(maxTokName, len(nm))
393393
a = append(a, nm)
394394
}
395395
nsyms[nm] = sym
@@ -476,7 +476,7 @@ type %[1]sXError struct {
476476
panic("internal error 001")
477477
}
478478

479-
maxv = mathutil.Max(maxv, xsym)
479+
maxv = max(maxv, xsym)
480480
kind, arg := act.Kind()
481481
switch kind {
482482
case 'a':

types/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ go_library(
1414
"//pkg/parser/format",
1515
"//pkg/parser/mysql",
1616
"//pkg/parser/terror",
17-
"@com_github_cznic_mathutil//:mathutil",
1817
],
1918
)
2019

types/field_type.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"strings"
2222
"unsafe"
2323

24-
"github.com/cznic/mathutil"
2524
"github.com/pingcap/tidb/pkg/parser/charset"
2625
"github.com/pingcap/tidb/pkg/parser/format"
2726
"github.com/pingcap/tidb/pkg/parser/mysql"
@@ -243,7 +242,7 @@ func (ft *FieldType) SetFlen(flen int) {
243242
// SetFlenUnderLimit sets the length of the field to the value of the argument
244243
func (ft *FieldType) SetFlenUnderLimit(flen int) {
245244
if ft.GetType() == mysql.TypeNewDecimal {
246-
ft.flen = mathutil.Min(flen, mysql.MaxDecimalWidth)
245+
ft.flen = min(flen, mysql.MaxDecimalWidth)
247246
} else {
248247
ft.flen = flen
249248
}
@@ -257,7 +256,7 @@ func (ft *FieldType) SetDecimal(decimal int) {
257256
// SetDecimalUnderLimit sets the decimal of the field to the value of the argument
258257
func (ft *FieldType) SetDecimalUnderLimit(decimal int) {
259258
if ft.GetType() == mysql.TypeNewDecimal {
260-
ft.decimal = mathutil.Min(decimal, mysql.MaxDecimalScale)
259+
ft.decimal = min(decimal, mysql.MaxDecimalScale)
261260
} else {
262261
ft.decimal = decimal
263262
}

0 commit comments

Comments
 (0)