projects
/
mono.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6fe8e00
)
[linq] fix Range extreme boundaries
author
Jb Evain
<jbevain@gmail.com>
Tue, 25 Jan 2011 22:45:44 +0000
(23:45 +0100)
committer
Jb Evain
<jbevain@gmail.com>
Tue, 25 Jan 2011 22:45:44 +0000
(23:45 +0100)
mcs/class/System.Core/System.Linq/Enumerable.cs
patch
|
blob
|
history
diff --git
a/mcs/class/System.Core/System.Linq/Enumerable.cs
b/mcs/class/System.Core/System.Linq/Enumerable.cs
index d0a4c77a73247f4d7bc11d5467082119503c44d4..56d52d4f45391875d38289ed1c46b9af57243fd7 100644
(file)
--- a/
mcs/class/System.Core/System.Linq/Enumerable.cs
+++ b/
mcs/class/System.Core/System.Linq/Enumerable.cs
@@
-2163,18
+2163,16
@@
namespace System.Linq
if (count < 0)
throw new ArgumentOutOfRangeException ("count");
if (count < 0)
throw new ArgumentOutOfRangeException ("count");
- long upto = ((long) start + count) - 1;
-
- if (upto > int.MaxValue)
+ if (((long) start + count) - 1L > int.MaxValue)
throw new ArgumentOutOfRangeException ();
throw new ArgumentOutOfRangeException ();
- return CreateRangeIterator (start,
(int) upto
);
+ return CreateRangeIterator (start,
count
);
}
}
- static IEnumerable<int> CreateRangeIterator (int start, int
upto
)
+ static IEnumerable<int> CreateRangeIterator (int start, int
count
)
{
{
- for (int i =
start; i <= upto
; i++)
- yield return i;
+ for (int i =
0; i < count
; i++)
+ yield return
start +
i;
}
#endregion
}
#endregion