Micro-optimization for IList.Contains array implementation (#7347)
authorJames Ko <jamesqko@gmail.com>
Sun, 25 Sep 2016 03:11:10 +0000 (23:11 -0400)
committerJan Kotas <jkotas@microsoft.com>
Sun, 25 Sep 2016 03:11:10 +0000 (20:11 -0700)
src/mscorlib/src/System/Array.cs

index b5cbcf0..2260fd7 100644 (file)
@@ -2799,7 +2799,7 @@ namespace System {
             //! Warning: "this" is an array, not an SZArrayHelper. See comments above
             //! or you may introduce a security hole!
             T[] _this = JitHelpers.UnsafeCast<T[]>(this);
-            return Array.IndexOf(_this, value) != -1;
+            return Array.IndexOf(_this, value, 0, _this.Length) >= 0;
         }
         
         bool get_IsReadOnly<T>() {
@@ -2818,7 +2818,7 @@ namespace System {
             //! Warning: "this" is an array, not an SZArrayHelper. See comments above
             //! or you may introduce a security hole!
             T[] _this = JitHelpers.UnsafeCast<T[]>(this);
-            return Array.IndexOf(_this, value);
+            return Array.IndexOf(_this, value, 0, _this.Length);
         }
         
         void Insert<T>(int index, T value) {