Merge pull request #9539 from flaviut/ft-remove-nre-floats
Eliminate floating point arithmatic in nre
This commit is contained in:
commit
45040a8716
1 changed files with 2 additions and 1 deletions
|
|
@ -469,7 +469,8 @@ proc matchImpl(str: string, pattern: Regex, start, endpos: int, flags: int): Opt
|
||||||
# 1x capture count as slack space for PCRE
|
# 1x capture count as slack space for PCRE
|
||||||
let vecsize = (pattern.captureCount() + 1) * 3
|
let vecsize = (pattern.captureCount() + 1) * 3
|
||||||
# div 2 because each element is 2 cints long
|
# div 2 because each element is 2 cints long
|
||||||
myResult.pcreMatchBounds = newSeq[HSlice[cint, cint]](ceil(vecsize / 2).int)
|
# plus 1 because we need the ceiling, not the floor
|
||||||
|
myResult.pcreMatchBounds = newSeq[HSlice[cint, cint]]((vecsize + 1) div 2)
|
||||||
myResult.pcreMatchBounds.setLen(vecsize div 3)
|
myResult.pcreMatchBounds.setLen(vecsize div 3)
|
||||||
|
|
||||||
let strlen = if endpos == int.high: str.len else: endpos+1
|
let strlen = if endpos == int.high: str.len else: endpos+1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue