Commit Graph

978 Commits

Author SHA1 Message Date
Patrick Pijnappel
f81968341d [stdlib] Adjust formatting to fit 80 columns 2015-12-21 13:06:24 +11:00
Patrick Pijnappel
f8c155a80e [stdlib] Refactor Bit._withOverflow() 2015-12-20 17:41:49 +11:00
Patrick Pijnappel
56ed11ee3d [stdlib] Refactor local variables names 2015-12-20 17:29:54 +11:00
Patrick Pijnappel
9f162728f1 [stdlib] Fix bug in Bit with-overflow arithmetic
The original version would result in a crash for negative results.
2015-12-20 17:21:13 +11:00
Dmitri Gribenko
6f8bee17aa Merge pull request #576 from dduan/set_intersect_optimization
[Performance] iterate the smaller set during Set.intersect()
2015-12-19 17:26:42 -08:00
Daniel Duan
d919f4cb5c [stdlib] iterate the smaller set in Set.intersect()
This introduces a small constant in speed, but it's a big win for
worst case scenario.
2015-12-19 04:26:44 -08:00
Dmitri Gribenko
0c3f2e8b11 Merge pull request #657 from PatrickPijnappel/enums
[stdlib] Remove redundant CustomStringConvertible conformance
2015-12-19 03:09:25 -08:00
Patrick Pijnappel
b5c3e23c40 [stdlib] Remove redundant CustomStringConvertible conformance
The implementation is identical to the default string representation. The conformance and description property are never explicitly used.
2015-12-19 18:05:46 +11:00
Dmitri Gribenko
6a66b3cff8 Merge pull request #561 from practicalswift/typos-again
[Typo] Replace PR#514-525 with one large PR
2015-12-18 03:37:02 -08:00
Dmitri Gribenko
f436764742 Merge pull request #616 from dduan/removeAll_speedup
[stdlib][performance] skip copying old values during removeAll(keepCapacity: true)
2015-12-17 22:43:22 -08:00
Chris Lattner
3ec6239df3 Merge pull request #549 from zerotypos-found/fix_typo
Fix typo (a --> an, an --> a)
2015-12-17 22:25:22 -08:00
Dmitri Gribenko
ca1f0bf4ad Merge pull request #633 from PatrickPijnappel/patch-2
[stdlib] Remove explicit Equatable implementation for FloatingPointClassification
2015-12-17 21:40:57 -08:00
Dmitri Gribenko
61e2b30975 Merge pull request #615 from PatrickPijnappel/min-max
[stdlib] Refactor min()/max()
2015-12-17 17:14:52 -08:00
Patrick Pijnappel
7e96565c1a [stdlib] Remove explicit Equatable implementation for FloatingPointClassification 2015-12-18 11:04:12 +11:00
Patrick Pijnappel
a61839d696 [stdlib] Add ordering guarantee to min() and max() docs 2015-12-18 09:51:34 +11:00
Chris Lattner
99fcb2dfe1 Change all uses of x = x.successor() to use x._successorInPlace()
...because it is apparently more efficient in some cases.  Technically
we don't do this in ALL places, because it would be unfortunate if
the implementation of _successorInPlace() were self recursive :-)
2015-12-16 22:38:37 -08:00
Daniel Duan
b177c69d6b skip copying old values during removeAll()
As noted in FIXME(performance), calling `.removeAll(keepCapacity: true)` on a
containter of type Dictionay or Set causes a copy of its storage being made.
Only then, it would proceed to delete each element.

This patch makes these hashed collections skip the wasteful copying step.
2015-12-16 22:28:38 -08:00
zerotypos-found
0c1df3577e Fix typo: a --> an, an --> a. 2015-12-17 15:10:25 +09:00
Patrick Pijnappel
fe478b7633 [stdlib] Add sort stability comment to min()/max() 2015-12-17 14:17:50 +11:00
Patrick Pijnappel
75a6609c61 [stdlib] Unabbreviate local variable names 2015-12-17 14:07:58 +11:00
Patrick Pijnappel
370f4f0de4 [stdlib] Refactor min(_:_:_:_:) 2015-12-17 14:00:03 +11:00
Patrick Pijnappel
220f2d1c89 [stdlib] Refactor min(_:_:) 2015-12-17 13:59:48 +11:00
Patrick Pijnappel
58bc25bed6 [stdlib] Add comment 2015-12-17 10:15:45 +11:00
Patrick Pijnappel
8d1261ed22 [stdlib] Fix Int(_:radix:) accepting unintentional cases (SR-187) 2015-12-17 10:12:36 +11:00
Patrick Pijnappel
0998e38ef4 [stdlib] Fix internal doc comment 2015-12-17 09:57:53 +11:00
practicalswift
8ab8847684 Fix typos. 2015-12-16 22:09:32 +01:00
Arsen Gasparyan
9f728c6dbd [stdlib] Make comparison operator choices consistent 2015-12-16 22:50:36 +03:00
Chris Lattner
e9a2e1e128 Eliminate all of the uses of ++/-- from stdlib/public/core.
At DaveA's suggestion, I took a mostly mechanical approach to this:
pointers and numeric types start using += 1, and indexes use
i = i.successor().  The index model is likely to be revised in
Swift 3 anyway, so micro-optimizing this code syntactically isn't
super important.

There is some performance concern of this patch, since some
in-place succesor operations are more efficient than
i = i.successor().  The one that seems particularly at issue is the
instance in the implementation of partition(), which I changed to
use i._successorInPlace().  If other instances lead to a perf issue,
they can be changed to use that as well.
2015-12-15 23:21:55 -08:00
Niels Andriesse
f725352706 Update BidirectionalIndexType.advancedBy(_:_:) for removal of ++ operator 2015-12-16 14:39:35 +11:00
Niels Andriesse
7807fe7160 Update BidirectionalIndexType.advancedBy(_:) for removal of ++ operator 2015-12-16 14:26:17 +11:00
Dmitri Gribenko
8749117362 Merge pull request #571 from nassersala/typo-print-dot-swift
Fix typos: add missing backticks to 'Streamable'
2015-12-15 17:41:56 -08:00
Dmitri Gribenko
2f538f8b2b Merge pull request #568 from frootloops/enumerate-generator-count
Set default value for EnumerateGenerator.count
2015-12-15 17:41:37 -08:00
Dmitri Gribenko
d864cfcf3d Merge pull request #556 from dduan/increment_decrement_search_replace
replace singular statement ++/-- with += 1/-= 1 for integer variables
2015-12-15 17:39:29 -08:00
Nasser Ali AlZahrani
26669bd28e Fix typos: add missing backticks to 'Streamable' 2015-12-16 11:28:03 +11:00
Arsen Gasparyan
ee97757756 Set default value 2015-12-15 23:30:08 +03:00
Dmitri Gribenko
f25bf9eaf7 Merge pull request #544 from nielsandriesse/patch-11
Update _DropFirstSequence.next() for removal of ++ operator
2015-12-15 09:42:09 -08:00
Daniel Duan
ebb0c3a204 replaced single-line ++/-- with +=/-= 2015-12-15 09:05:37 -08:00
Dmitri Gribenko
10a8f4e3f9 Merge pull request #348 from wczekalski/bugfix/float-string-precision
Fix precision of float to string to max significant decimals
2015-12-15 02:41:49 -08:00
Chris Lattner
566d6a1728 Merge pull request #479 from PatrickPijnappel/spelling-grammar
[stdlib] Fix spelling & grammar
2015-12-14 20:10:46 -08:00
Dmitri Gribenko
8b88e5e446 Merge pull request #545 from nielsandriesse/patch-12
Update _PrefixSequence.next() for removal of ++ operator
2015-12-14 20:03:13 -08:00
Niels Andriesse
380c4e53c8 Update CollectionType.split(_:_:_:) for removal of ++ operator 2015-12-15 11:51:55 +11:00
Niels Andriesse
967ac96bb1 Update _PrefixSequence.next() for removal of ++ operator 2015-12-15 11:16:42 +11:00
Niels Andriesse
0e71b9277d Update _DropFirstSequence.next() for removal of ++ operator 2015-12-15 11:04:41 +11:00
Wojtek Czekalski
10b61b7d8c Made floating point numbers conform to CustomDebugStringConvertible
debugDescription prints numbers with greater precision
2015-12-14 19:25:14 +01:00
Wojtek Czekalski
e4fe5f1508 Introduced debug parameter in floating point to string conversion 2015-12-14 19:25:13 +01:00
Dmitri Gribenko
931b07fb62 Merge pull request #474 from PatrickPijnappel/patch-3
Expand tuple properties in Zip2Sequence/Generator
2015-12-14 02:45:37 -08:00
Chris Willmore
070d11031d Merge pull request #452 from dayitv89/gds-Fixtypos_cstring
Fix typo "nul-terminated" -> "null-terminated"
2015-12-13 21:06:42 -08:00
Dmitri Gribenko
a014eab642 Merge pull request #490 from kballard/swap-docstring-requires
[stdlib] Add note to swap() docstring about non-aliasing requirement
2015-12-13 18:03:49 -08:00
Arnold Schwaighofer
391237b134 Use subscript get for all array like types
Given SR-219 and the fact that we can't hoist uniqueness checks in the current
form using a plain subscript getter is not worse.
2015-12-13 17:25:41 -08:00
Kevin Ballard
a8833b5873 [stdlib] Add note to swap() docstring about non-aliasing requirement 2015-12-13 13:54:17 -08:00