-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the DoubleWidth
type
#197
Conversation
I tried to test the + swiftSettings: [.unsafeFlags(["-parse-stdlib"])]
+import Swift
- public init(_builtinIntegerLiteral _x: Builtin.IntegerLiteral) {
+ public init(_builtinIntegerLiteral _x: Builtin.IntLiteral) {
- if !Bool(_overflow) {
+ if !Bool(_builtinBooleanLiteral: _overflow) {
- public init(integerLiteral x: Int) {
- self.init(x)
- } There are two unrecognized builtins:
When arbitrary-precision literals were implemented, |
Hi @benrimmington thanks. Just to set expectations, I'm booked up this week and on vacation next week, so it will probably be a little while before I get to take a look at this in any detail. |
Hi Ben, finally getting a chance to look at this, sorry for the delay. Generally this seems fine (as expected, given that it's mostly borrowed from Swift's prototype). I think the only thing I'd like to tweak is a meta-point of not packaging a library for it yet (since it's still "experimental" and hence we don't really want to encourage use outside the project). However, I do have fairly immediate use cases in mind for testing some of the new IntegerUtilities API, so I think the best thing to do would be to move DoubleWidth into TestUtilities, where it will be available for use testing anything else. If you have a specific use case that merits vending a library, let's discuss further. |
Do you want me to do this, or would it be better if you (or Nate Cook, as the original implementer of DoubleWidth) added the files? |
Sorry, yes, I mean _TestSupport. I'm happy to do this if you don't have time at the moment. |
Thanks! I'll finish reviewing this later today or tomorrow. |
@swift-ci please test |
I moved |
I'll take a look at the CMake build as part of my review. |
IntegerUtilitiesTests now has a _TestSupport dependency (in Package.swift), shall I update CMakeLists.txt as well? |
Co-authored-by: Nate Cook <[email protected]> Co-authored-by: Max Moiseev <[email protected]> Co-authored-by: Xiaodi Wu <[email protected]>
@swift-ci test |
Delighted to see this code in runnable form again—thanks @benrimmington! |
The
DoubleWidth<Base>
type has twice the bit width of its base type.It was proposed in SE-0104, but never shipped (due to compiler problems).
The
DoubleWidth.swift
file is generated from the latest GYB template:utils/gyb --line-directive="" test/Prototypes/DoubleWidth.swift.gyb
The
DoubleWidthTests.swift
file is a translation of the original tests (from StdlibUnittest to XCTest), excluding theexpectCrashLater()
calls.There are also some new and updated tests — for string conversions and SR-6947.
DoubleWidthTests
…_Hexadecimal()
…_LeftAndRightShifts()
DoubleWidthTests
…_Hexadecimal()
…_LeftAndRightShifts()