Skip to content

Commit 2b8da0c

Browse files
committed
Remove all checks and inline blit
1 parent 2323f91 commit 2b8da0c

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

src/fsharp/FSharp.Core/array.fs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,8 @@ namespace Microsoft.FSharp.Collections
8383

8484
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>]
8585
[<CompiledName("CopyTo")>]
86-
let blit (source : 'T[]) sourceIndex (target: 'T[]) targetIndex count =
87-
checkNonNull "source" source
88-
checkNonNull "target" target
89-
if sourceIndex < 0 then invalidArg "sourceIndex" (SR.GetString(SR.inputMustBeNonNegative))
90-
if count < 0 then invalidArg "count" (SR.GetString(SR.inputMustBeNonNegative))
91-
if targetIndex < 0 then invalidArg "targetIndex" (SR.GetString(SR.inputMustBeNonNegative))
92-
if sourceIndex + count > source.Length then invalidArg "count" (SR.GetString(SR.outOfRange))
93-
if targetIndex + count > target.Length then invalidArg "count" (SR.GetString(SR.outOfRange))
86+
let inline blit (source : 'T[]) (sourceIndex:int) (target: 'T[]) (targetIndex:int) (count:int) =
9487
Array.Copy(source, sourceIndex, target, targetIndex, count)
95-
// for i = 0 to count - 1 do
96-
// target.[targetIndex+i] <- source.[sourceIndex + i]
9788

9889
let rec concatAddLengths (arrs:'T[][]) i acc =
9990
if i >= arrs.Length then acc

src/fsharp/FSharp.Core/array.fsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ namespace Microsoft.FSharp.Collections
6262
/// <exception cref="System.ArgumentException">Thrown when any of sourceIndex, targetIndex or count are negative,
6363
/// or when there aren't enough elements in source or target.</exception>
6464
[<CompiledName("CopyTo")>]
65-
val blit: source:'T[] -> sourceIndex:int -> target:'T[] -> targetIndex:int -> count:int -> unit
65+
val inline blit: source:'T[] -> sourceIndex:int -> target:'T[] -> targetIndex:int -> count:int -> unit
6666

6767
/// <summary>For each element of the array, applies the given function. Concatenates all the results and return the combined array.</summary>
6868
/// <param name="mapping">The function to create sub-arrays from the input array elements.</param>

0 commit comments

Comments
 (0)