Skip to content

Commit 3744f53

Browse files
committed
Fix two unapparent errors in the unroll loop, fix nit on parens
1 parent 3a91ebc commit 3744f53

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/fsharp/FSharp.Core/string.fs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,17 @@ namespace Microsoft.FSharp.Core
4848
String.Empty
4949
else
5050
let result = str.ToCharArray()
51-
let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt mapping
51+
let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt(mapping)
5252

5353
// x2 unrolled loop gives 10-20% boost, overall 2.5x SB perf
5454
let mutable i = 0
5555
while i < len - len % 2 do
5656
result.[i] <- f.Invoke(i, result.[i])
57-
result.[i + 1] <- f.Invoke(i, result.[i + 1])
58-
i <- i + 2
57+
i <- i + 1
58+
result.[i] <- f.Invoke(i, result.[i])
59+
i <- i + 1
5960

60-
if i % 2 = 1 then
61+
if len % 2 = 1 then
6162
result.[i] <- f.Invoke(i, result.[i])
6263

6364
new String(result)

0 commit comments

Comments
 (0)