diff options
author | three <three3q@qq.com> | 2021-08-13 01:32:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-13 01:32:44 +0800 |
commit | f6f14f507ee1adf4883cb1b12f27932a63afb286 (patch) | |
tree | 36128e53dc1b54f555bdd944829b1a4eb270f053 /calc.go | |
parent | 61d0ed1ff26fbe47b4bfdc6adbc6db09743beb3a (diff) |
Speed up merge cells
Diffstat (limited to 'calc.go')
-rw-r--r-- | calc.go | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -5103,11 +5103,11 @@ func (fn *formulaFuncs) kth(name string, argsList *list.List) formulaArg { return newErrorFormulaArg(formulaErrorVALUE, fmt.Sprintf("%s requires 2 arguments", name)) } array := argsList.Front().Value.(formulaArg).ToList() - kArg := argsList.Back().Value.(formulaArg).ToNumber() - if kArg.Type != ArgNumber { - return kArg + argK := argsList.Back().Value.(formulaArg).ToNumber() + if argK.Type != ArgNumber { + return argK } - k := int(kArg.Number) + k := int(argK.Number) if k < 1 { return newErrorFormulaArg(formulaErrorNUM, "k should be > 0") } @@ -7177,7 +7177,7 @@ func (fn *formulaFuncs) VLOOKUP(argsList *list.List) formulaArg { func vlookupBinarySearch(tableArray, lookupValue formulaArg) (matchIdx int, wasExact bool) { var low, high, lastMatchIdx int = 0, len(tableArray.Matrix) - 1, -1 for low <= high { - var mid int = low + (high-low)/2 + mid := low + (high-low)/2 mtx := tableArray.Matrix[mid] lhs := mtx[0] switch lookupValue.Type { @@ -7216,7 +7216,7 @@ func vlookupBinarySearch(tableArray, lookupValue formulaArg) (matchIdx int, wasE func hlookupBinarySearch(row []formulaArg, lookupValue formulaArg) (matchIdx int, wasExact bool) { var low, high, lastMatchIdx int = 0, len(row) - 1, -1 for low <= high { - var mid int = low + (high-low)/2 + mid := low + (high-low)/2 mtx := row[mid] result := compareFormulaArg(mtx, lookupValue, false, false) if result == criteriaEq { |