Commit Graph

13406 Commits

Author SHA1 Message Date
Saleem Abdulrasool
af6d9e3fc3 Shims: use _hypotf on Windows rather than __builtin_hypot
Unfortunately, `hypotf` is an inline in MSVCRT which forwards to
`_hypotf`.  This repairs the Windows build.
2019-04-03 16:11:42 -07:00
Eric Bainville
b1d4d40516 take DataProtocol as input; simplified errors; fixed availability 2019-04-03 15:20:40 -07:00
Ted Kremenek
777750dc51 Merge pull request #23140 from stephentyrone/mafs
Math functions for Swift
2019-04-03 14:53:16 -07:00
Steve (Numerics) Canon
bcc7e2c901 Obscene rant about linters. 2019-04-03 15:15:28 -04:00
Karoy Lorentey
3c74c0f1cb [stdlib] Change the signature of Dictionary’s bulk initializer (#23758)
The initializer was originally introduced without proper availability; in https://github.com/apple/swift/pull/23643, we fixed this by applying the `@_alwaysEmitIntoClient` attribute. However, this had the unfortunate side-effect that the symbol disappeared from `libswiftCore.dylib`, which somehow confuses some simulator builds.

Try to figure out what’s happening by replacing the third closure argument with an integer return value. This changes the mangled name of the bulk initializer, which should make it more obvious how/why these builds fail.

rdar://problem/49479386
2019-04-03 10:51:36 -07:00
simon gladman
4721423535 Added floatToDouble and doubleToFloat 2019-04-03 13:49:58 +01:00
simon gladman
a0f504b821 Add conversion operations that return the result. 2019-04-03 11:37:33 +01:00
Michael Ilseman
aab8063267 [SE-0247] Add contiguous string APIs
Adds API for querying, enforcing, and using contiguous strings.
2019-04-02 20:30:02 -07:00
Ravi Kandhadai
2f2afd034d [os_log][stdlib-private] Add tests for checking the correctness of
buffer and format string construction in the new OS log APIs.
2019-04-02 17:31:40 -07:00
Karoy Lorentey
ea6ae67a9f [stlib] _NativeSet: Revert spurious change 2019-04-02 16:38:01 -07:00
Steve (Numerics) Canon
3fda509805 Implementation of ElementaryFunctions / Real protocols.
This commit implements SE-0246, by adding conformance to Real to the Float, CGFloat, Double, and Float80 types, implemented either in terms of the system's C math library, existing standard library functionality, or LLVM intrinsics. It includes basic test coverage for these new functions, and deprecates and obsoletes *some* existing functionality in the Platform overlay. We still need to make a decision about how to handle the remaining "tgmath" functions, because obsoleting them is technically a source-breaking change (if users have unqualified names like "exp(1)", it's fine, but it would break users who have used qualified names like "Darwin.exp(1)".)
2019-04-02 18:49:31 -04:00
Steve (Numerics) Canon
2f7435da7d First non-intrinsic functions. 2019-04-02 18:48:08 -04:00
Steve (Numerics) Canon
b8d1481fc6 WOW\! 100% less gratuitous type machinery at runtime\! 2019-04-02 18:48:08 -04:00
Steve (Numerics) Canon
5e5cd76e8d Work in progress towards "Mathsable"
Fundamental decision to be made; should implementation hooks present like `Float.exp(_ x: Float) -> Float` or like `Float.Maths.exp(_ x: Float) -> Float`? Having the intermediate namespace to group them as in the second is definitely nicer, but it requires a little bit of extra machinery, and much more importantly, there doesn't seem to be any way to make access to the static `Maths` associatedtype transparent.
2019-04-02 18:48:08 -04:00
Karoy Lorentey
1ddf99a9da [stdlib] Set, Dictionary: Unify casting operations 2019-04-02 13:10:55 -07:00
simon gladman
df1ed6a879 Merge branch 'master' into accelerate-vDSP-conversion 2019-04-02 17:32:15 +01:00
simon gladman
4cfbaa90b8 Add conversion functions that return the result. 2019-04-02 17:29:26 +01:00
Michael Ilseman
ff39c345fd Merge pull request #22869 from milseman/gab_barg
[SE-0248] String Gaps
2019-04-02 09:28:34 -07:00
simon gladman
1a66a0f00f Merge branch 'master' into accelerate-vDSP-miscConversions 2019-04-02 16:19:30 +01:00
simon gladman
0606fdd98b Create versions of window and ramp generation operations that return a result. 2019-04-02 16:13:01 +01:00
Stephen Canon
60fc39e72a Improve codegen for init(signOf: magnitudeOf:) (#23727)
This can map straight to the LLVM copysign intrinsic for builtin types, which both gets us better codgen and lets the compiler plug this operation into other LLVM-level optimizations.
2019-04-02 09:49:18 -04:00
simon gladman
fb9fa8dea3 Merge branch 'master' into accelerate-vDSP-fillClearGenerate 2019-04-02 10:07:52 +01:00
Hiroki Nagasawa
f85ca6c01a Remove redundant space in first(where:) of Sequence (#23365) 2019-04-01 10:56:16 -05:00
simon gladman
d84b0652fb Merge branch 'master' into accelerate-vDSP-complexOperations 2019-04-01 15:30:40 +01:00
simon gladman
9f752aa0d9 Add versions of operations that return the result. 2019-04-01 14:31:05 +01:00
simon gladman
fd42237e45 Merge branch 'master' into accelerate-vDSP-elementwiseVectorArithmetic 2019-04-01 10:58:18 +01:00
Saleem Abdulrasool
19cd786ca6 platform: correct case for WinSDK module (NFC)
This adjusts the case so that it can build on case sensitive file
systems (e.g. ext4).
2019-03-31 13:07:42 -07:00
Saleem Abdulrasool
fc3014c9d7 platform: add ACLAPI to WinSDK
This is needed to implement chmod-like functionality on Windows.  Ensure
that the ACL APIs are available to swift.
2019-03-30 21:40:10 -07:00
Karoy Lorentey
2bd5da539e [stdlib] Fix Set/Dictionary casting issues
- Fix Set/Dictionary up/downcasting with String keys.
- Improve error handling.
2019-03-29 19:15:09 -07:00
Michael Ilseman
3923fb2268 [String] String.Index.init(_:within:) bounds checks
Bounds check the given index for String.Index's generic initializer
that makes sure a passed index is a valid one for the given
StringProtocol.
2019-03-29 15:43:00 -07:00
Michael Ilseman
0ece62d911 [String] Add Substring.base
Adds Substring.base, analogous to Slice.base, to access the entire
String.

Tests added.
2019-03-29 15:43:00 -07:00
Michael Ilseman
aa519362f3 [String] Add Character.UTF16View and Character.UTF8View
Adds these collections, which are just String's views.

Tests added.
2019-03-29 15:43:00 -07:00
Michael Ilseman
b19c2cf9c3 [String] Add generic String.Index and range inits within a String
Adds a generic version of String.Index.init?(_:within:) and
Range<String.Index>.init?(_:in:).

Tests added
2019-03-29 15:43:00 -07:00
Michael Ilseman
4967fc08eb [Unicode] Add convenience APIs to Unicode encodings
Add convenience APIs to the stdlib's Unicode encodings:

* Unicode.UTF16
  * isASCII
  * isSurrogate
* Unicode.UTF8
  * isASCII
  * width
* Unicode.UTF32
  * isASCII
* Unicode.ASCII
  * isASCII

Tests added
2019-03-29 15:43:00 -07:00
Michael Ilseman
b6a158e1fc [stdlib] Add LegacyABI.swift for legacy non-API declarations 2019-03-29 15:43:00 -07:00
Michael Ilseman
751cf26ef5 [Unicode.Scalar] Add RAC UTF8View
This adds new (availability-controlled) API to Unicode.Scalar,
exposing the scalar's UTF-8 code units as a random-access collection
similarly to how it currently exposes UTF-16 code units.

Tests added.
2019-03-29 15:43:00 -07:00
Karoy Lorentey
7b654b372f [stdlib] Fix availability of Dictionary’s bulk-loading initializer (#23643)
Making it @_alwaysEmitIntoClient makes it available in all OS versions.
2019-03-29 12:54:56 -07:00
simon gladman
80c529dd89 Add operations that return their result. 2019-03-29 16:48:08 +00:00
simon gladman
23b75ed3b0 Merge branch 'master' into accelerate-vDSP-linearInterpolation 2019-03-29 16:17:23 +00:00
simon gladman
6f803763a6 Add operations that return result. 2019-03-29 16:16:57 +00:00
simon gladman
3b87572e99 Merge branch 'master' into accelerate-vDSP-miscConversions 2019-03-29 15:40:56 +00:00
simon gladman
40523b399e add operations that return the result 2019-03-29 15:38:45 +00:00
simon gladman
3c7768e35a Merge branch 'master' into accelerate-vDSP-singleVectorOperations 2019-03-29 14:50:18 +00:00
simon gladman
a3478e0b46 Create versions of operations that return the result. 2019-03-29 14:47:12 +00:00
simon gladman
42355b390d Merge branch 'master' into accelerate-vDSP-differenceEquationAndDownsampling 2019-03-29 13:37:56 +00:00
simon gladman
6a700fdc2a Add operations that return the result 2019-03-29 13:34:32 +00:00
simon gladman
ebffbbef39 Merge branch 'master' into accelerate-vDSP-convolution 2019-03-29 11:38:33 +00:00
simon gladman
850e1a48de Add operations that return a result. 2019-03-29 11:21:28 +00:00
simon gladman
2308927ac1 Merge branch 'master' into accelerate-vDSP-geometry 2019-03-29 10:48:45 +00:00
simon gladman
2547585013 Add versions of operations that return a result. 2019-03-29 10:48:13 +00:00