Commit Graph

3606 Commits

Author SHA1 Message Date
Nate Cook
1e59f65a91 Implement tricky full-width multiply/divides 2017-05-24 19:16:26 -05:00
Nate Cook
2edbb085d0 Fix overflow issues 2017-05-24 19:16:26 -05:00
Nate Cook
788f4e81b6 Add recursive constraints for integer Magnitude 2017-05-24 19:16:26 -05:00
Nate Cook
b935be828c Remove endian operations from fixed-width ints 2017-05-24 19:16:26 -05:00
Nate Cook
b72449bc72 Provide implementations or masking bitshift operators 2017-05-24 19:16:26 -05:00
Nate Cook
a539919052 Add negation operator/method to DoubleWidth 2017-05-24 19:16:26 -05:00
Nate Cook
c866bcf3d4 Convert endian symbols to default implementations 2017-05-24 19:16:26 -05:00
Nate Cook
b2676f90ca Use literals instead of DoubleWidth inits 2017-05-24 19:16:26 -05:00
Nate Cook
8926df9bbc [stdlib] Partial implementation of DoubleWidth 2017-05-24 19:16:26 -05:00
Dave Abrahams
807410b99e [stdlib] Make String("...") non-failable in Swift 4 2017-05-24 16:11:34 -07:00
Dave Abrahams
6cea7c1b5d [stdlib] Correct constraints on disambiguating overload
/cc @moiseev
2017-05-24 16:11:16 -07:00
Dave Abrahams
801b9c5544 [stdlib] Move specialization from init to append
Since init just calls append anyway, it's 2 birds/1 stone
2017-05-24 16:10:34 -07:00
Pavol Vaskovic
f123404f95 Every dot counts. Period. 2017-05-25 00:08:19 +02:00
practicalswift
1283248ebd [gardening] Add missing copyright header 2017-05-24 21:27:28 +02:00
Dave Abrahams
52cf9e52c4 Merge pull request #9811 from palimondo/struct-the-class
[stdlib] Sequence internals with struct instead of class.
2017-05-24 12:05:34 -07:00
Dave Abrahams
794a287c27 Kill a stray TAB
How'd that get in there?

Thanks, @moiseev
2017-05-24 04:10:25 -07:00
Maxim Moiseev
96b5b77081 Merge pull request #9888 from moiseev/unambiguous-array-filter
[stdlib] Moving the Array.filter to _ArrayProtocol
2017-05-23 20:59:28 -07:00
Xiaodi Wu
afa4e12fa6 Refine wording in doc comment 2017-05-23 21:10:04 -05:00
Xiaodi Wu
e30a003bca Update BinaryInteger default initializer documentation
Some time ago, it was pointed out that "truncating" would be used only for bit pattern operations. As pointed out on Swift Evolution, this is the only spot where the same term is used for dropping the fractional part of a floating point value; elsewhere, it is always spelled--even in documentation--as "rounded toward zero." This PR updates the usage here to align with existing convention.
2017-05-23 21:07:16 -05:00
Max Moiseev
5590872b35 [stdlib] Moving the Array.filter to _ArrayProtocol
Resolves ambiguity in the following expression

  _ = Array(0..<10).lazy.flatMap { .some($0) }.filter { _ in false }

Fixes: <rdar://problem/32316948>
2017-05-23 17:32:23 -07:00
Dave Abrahams
399193ff30 Merge pull request #9847 from apple/eliminate-_Element
[stdlib] Eliminate _Element
2017-05-23 16:44:55 -07:00
Dave Abrahams
b3a3b52783 Merge pull request #9798 from apple/inline-stable-grapheme-fastpaths
Inline stable grapheme fastpaths
2017-05-23 15:18:32 -07:00
Michael Ilseman
527f2c4dd7 Merge pull request #9858 from milseman/got_no_cache
[stdlib] String: drop TLS setText cache.
2017-05-23 12:24:13 -07:00
Dave Abrahams
3d789cff2d Inlineable character fast paths 2017-05-23 01:42:28 -07:00
swift-ci
1c390bc578 Merge pull request #9846 from apple/remove-redundant-slicing 2017-05-23 00:52:56 -07:00
Ted Kremenek
dbe77601f3 Merge pull request #9791 from itaiferber/swift-archival-serialization-updates
Enhancements to Codable API
2017-05-22 23:53:49 -07:00
Dave Abrahams
0016379d82 Merge branch 'master' into remove-redundant-slicing 2017-05-22 20:48:23 -07:00
Michael Ilseman
1bc1011e31 [stdlib] String: drop TLS setText cache.
The overhead of the weak reference overwhelms the savings from
avoiding the setText, when there's a fair amount of reference counting
involved. The real solution will be to use an unowned reference. For
now, drop the cache and introduce it once we have more runtime
functionality.
2017-05-22 18:59:06 -07:00
Dave Abrahams
b677e1d6e4 [stdlib] Remove now-redundant slicing operations 2017-05-22 16:34:05 -07:00
Dave Abrahams
72f5e7c0c2 [stdlib] Eliminate _Element 2017-05-22 16:17:58 -07:00
Dave Abrahams
4f5e14845b [stdlib] Eliminate optionals from specialization code
Apparently this makes the optimizer happier.  Still waiting on #9792 for truly
efficient specialization.

https://github.com/apple/swift/pull/9792
2017-05-22 15:59:43 -07:00
Itai Ferber
d16297dad5 Introduces changes to Codable stdlib API
* Adds conformance of Optional to Codable
* encode(...) arguments are no longer Optional; Optional values go
  through generic version
* encodeIfPresent added to KeyedEncodingContainerProtocol to mirror
  decodeIfPresent
* JSONEncoder and PropertyListEncoder updated to reflect these changes
2017-05-22 09:29:36 -07:00
Ben Cohen
02e2bd5380 Re-gyb sorting (#9818) 2017-05-21 16:59:46 -07:00
Dave Abrahams
70a437c846 [stdlib] Remove invalid _sanityCheck
A `Character` _should_ contain only a single grapheme, but we can't formally require it because of grapheme cluster literals and the shifting sands of Unicode.  Fixes https://bugs.swift.org/browse/SR-4955
2017-05-21 08:00:43 -07:00
Pavol Vaskovic
b57aa7c057 Sequence internals with struct instead of class.
_DropFirstSequence, _PrefixSequence and _DropWhileSequence as structs.

I turns out we DON’T require reference semantics to keep track of how many elements we've already taken from the underlying sequence.

… that’s taken care of by the underlying sequence, which has to have reference semantics if it needs them.
2017-05-21 08:02:37 +02:00
Maxim Moiseev
4ec2838e8d Merge pull request #9757 from moiseev/renamed-intmax
[stdlib] Providing fixits for IntMax and UIntMax
2017-05-19 07:31:54 -07:00
swift-ci
32b4e56ca5 Merge pull request #7183 from apple/rdar-25398370 2017-05-18 18:29:02 -07:00
Max Moiseev
368847b5c7 [stdlib] Providing fixits for IntMax and UIntMax 2017-05-18 18:00:45 -07:00
Dave Abrahams
fe76f6b147 [stdlib] Add and use _identityCast 2017-05-18 17:41:15 -07:00
Dave Abrahams
fd30b72ee1 [stdlib] Fix a race
Lock-free programming is almost always a bug.
Fixes <rdar://25398370> Data Race in StringBuffer.append (found by TSan)
2017-05-18 16:29:59 -07:00
swift-ci
2a5d7a13f1 Merge pull request #9745 from eeckstein/disable-gen-inline 2017-05-18 16:14:49 -07:00
Erik Eckstein
74fa0bcc87 Disable generic inlining and partial specialization, except in libswiftCore
This avoids code size regressions in programs while still getting the performance improvements in generic code in the stdlib.

rdar://problem/32277313
2017-05-18 15:38:54 -07:00
Max Moiseev
fd2ac31c6e [stdlib] Adding RangeReplaceable.filter returning Self
This overload allows `String.filter` to return a `String`, and not
`[Character]`.

In the other hand, introduction of this overload makes `[123].filter`
somewhat ambiguous in a sence, that the compiler will now prefer an
implementatin from a more concrete protocol, which is less efficient for
arrays, therefore extra work is needed to make sure Array types fallback
to the `Sequence.filter`.

Implements: <rdar://problem/32209927>
2017-05-18 12:24:13 -07:00
Dave Abrahams
c67977a881 [stdlib] Replace Integer Parsing Code 2017-05-18 07:00:34 -07:00
Nate Cook
ca5c65f93c [stdlib] Nest some additional operators (#9646) 2017-05-17 19:44:08 -07:00
swift-ci
c0623c42ce Merge pull request #9722 from apple/stringprotocol-interchange 2017-05-17 19:13:25 -07:00
Michael Ilseman
948ba4d4e3 Merge pull request #9684 from milseman/tls_ftw
[stdlib] Unicode 9 and Thread Local Storage (again)
2017-05-17 18:32:25 -07:00
Maxim Moiseev
130231456b Merge pull request #9714 from moiseev/int-perf
[stdlib] Speeding up typechecking for complex expressions with integers
2017-05-17 17:33:47 -07:00
Dave Abrahams
d6fee05375 [stdlib] Enable interchange among StringProtocol models 2017-05-17 17:21:43 -07:00
Dave Abrahams
2f5a327f82 Merge pull request #9561 from apple/string-init-from-character-speedup
[stdlib] Speed up String(largeCharacter)
2017-05-17 17:14:12 -07:00