Commit Graph

13 Commits

Author SHA1 Message Date
Saleem Abdulrasool
c17e67e1a9 stdlib: handle unsafe annotations in additional places
This applies more annotations in the `INTERNAL_CHECKS_ENABLED` disabled
paths, Windows, 32-bit, and non-ObjC paths. Interestingly enough, there
are a couple of compiler intrinsics which are also uncovered.
2025-06-18 09:46:17 -07:00
Doug Gregor
22eecacc35 Adopt unsafe annotations throughout the standard library 2025-02-26 14:28:01 -08:00
Oscar Byström Ericsson
4d43fa97b7 Fix recoverable [U]Int128 division-by-zero (#77854)
* Fix recoverable [U]Int128 division-by-zero

This patch fixes the division-by-zero case in the following methods:

- `Int128/dividedReportingOverflow(by:)`
- `Int128/remainderReportingOverflow(dividingBy:)`
- `UInt128/dividedReportingOverflow(by:)`
- `UInt128/remainderReportingOverflow(dividingBy:)`

* Add preconditions to trapping [U]Int128 division methods.

* Make consistent use of `_slowPath(_:)`.

Jumping on the `_slowPath(_:)` bandwagon like all other integer types.

* Copy existing UInt128 division comments to division operators.

* Add a comment about signed remainder overflow semantics as requested.

I have paraphrased @stephentyrone's and @xwu's review comments to the best of my ability.
2024-12-07 16:44:54 -05:00
Xiaodi Wu
ea1baed83a Address 128-bit integer comparison type inference issue (#75529) 2024-07-28 21:38:38 -07:00
Carl Peto
3689427834 [AVR] standard library support for AVR
- when compiling embedded cross compile target standard libraries, include AVR
- add 16-bit pointer as a conditional compilation condition and get the void pointer size right for gyb sources
- attempt to fix clang importer not importing __swift_intptr_t correctly on 16 bit platforms
- changed the unit test target to avr-none-none-elf to match the cmake build

[AVR] got the standard library compiling in a somewhat restricted form:

General
- updated the Embedded Runtime
- tweaked CTypes.swift to fix clang import on 16 bit platforms

Strings
- as discussed in https://forums.swift.org/t/stringguts-stringobject-internals-how-to-layout-on-16-bit-platforms/73130, I went for just using the same basic layout in 16 bit as 32 bit but with 16 bit pointers/ints... the conversation is ongoing, I think something more efficient is possible but at least this compiles and will probably work (inefficiently)

Unicode
- the huge arrays of unicode stuff in UnicodeStubs would not compile, so I skipped it for AVR for now.

Synchronization
- disabled building the Synchronization library on AVR for now. It's arguable if it adds value on this platform anyway.
2024-07-16 12:28:27 +01:00
Ben Rimmington
7d3b2ef7d1 [stdlib] Update documentation of {U}Int128 types 2024-06-27 14:19:13 +01:00
Alejandro Alonso
87a8edb368 Microoptimize _low and _high and remove else branch
Update UInt128.swift
2024-06-18 16:08:41 -07:00
Alejandro Alonso
f8f7d0c6d3 Make _low and _high public 2024-06-18 15:03:30 -07:00
Alejandro Alonso
839c49bec3 Microoptimize _lowWord and fix else branch 2024-06-18 15:03:13 -07:00
Alejandro Alonso
68952e8281 It is remainder, not remainer 2024-06-18 13:46:57 -07:00
Alejandro Alonso
95ce270a77 Get rid of remaining uses of precondition 2024-06-18 12:45:16 -07:00
Alejandro Alonso
b059766481 Apply @_transparent consistently for (U)Int128 2024-06-18 10:47:48 -07:00
Stephen Canon
a381589524 SE-0425 implementation (#72139) 2024-04-02 16:24:41 -04:00