summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorFlaviu Tamas <tamasflaviu@gmail.com>2018-10-30 07:29:51 -0400
committerGitHub <noreply@github.com>2018-10-30 07:29:51 -0400
commit45040a8716172b6e84a4ddee98531deb472f1442 (patch)
tree1e3abca781ec8bff48f305408f8f312bdb0a373a /lib
parent331d1a6ca1d50df870837b6e5141e1c70e844c35 (diff)
parent2aa7eeda399e480018dc48eddb5f6d81ce904ee4 (diff)
downloadNim-45040a8716172b6e84a4ddee98531deb472f1442.tar.gz
Merge pull request #9539 from flaviut/ft-remove-nre-floats
Eliminate floating point arithmatic in nre
Diffstat (limited to 'lib')
-rw-r--r--lib/impure/nre.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/impure/nre.nim b/lib/impure/nre.nim
index ce3fb2aff..f1f4ae7eb 100644
--- a/lib/impure/nre.nim
+++ b/lib/impure/nre.nim
@@ -469,7 +469,8 @@ proc matchImpl(str: string, pattern: Regex, start, endpos: int, flags: int): Opt
   # 1x capture count as slack space for PCRE
   let vecsize = (pattern.captureCount() + 1) * 3
   # 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)
 
   let strlen = if endpos == int.high: str.len else: endpos+1