From 20b6c47d3f08f2d2a3a157b5a7b7163fa2acfc24 Mon Sep 17 00:00:00 2001 From: Clyybber Date: Sun, 28 Oct 2018 14:34:05 -0400 Subject: [PATCH] actually do ceiling division, not a similar operation Co-Authored-By: flaviut (cherry picked from commit 2aa7eeda399e480018dc48eddb5f6d81ce904ee4) --- lib/impure/nre.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/impure/nre.nim b/lib/impure/nre.nim index 5155194b03..f1f4ae7eb2 100644 --- a/lib/impure/nre.nim +++ b/lib/impure/nre.nim @@ -470,7 +470,7 @@ proc matchImpl(str: string, pattern: Regex, start, endpos: int, flags: int): Opt let vecsize = (pattern.captureCount() + 1) * 3 # div 2 because each element is 2 cints long # plus 1 because we need the ceiling, not the floor - myResult.pcreMatchBounds = newSeq[HSlice[cint, cint]]((vecsize div 2) + 1) + 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