File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -31,13 +31,14 @@ public struct Int128: Sendable {
31
31
@available ( SwiftStdlib 6 . 0 , * )
32
32
@_transparent
33
33
public var _low : UInt64 {
34
- UInt64 ( truncatingIfNeeded : self )
34
+ UInt64 ( Builtin . trunc_Int128_Int64 ( _value ) )
35
35
}
36
36
37
37
@available ( SwiftStdlib 6 . 0 , * )
38
38
@_transparent
39
39
public var _high : Int64 {
40
- Int64 ( truncatingIfNeeded: self &>> 64 )
40
+ let shifted : Int128 = self &>> 64
41
+ return Int64 ( Builtin . trunc_Int128_Int64 ( shifted. _value) )
41
42
}
42
43
43
44
@available ( SwiftStdlib 6 . 0 , * )
@@ -450,7 +451,7 @@ extension Int128: BinaryInteger {
450
451
#elseif _pointerBitWidth(_32)
451
452
UInt ( Builtin . trunc_Int128_Int32 ( _value) )
452
453
#else
453
- UInt ( truncatingIfNeeded : self )
454
+ #error("Unsupported platform" )
454
455
#endif
455
456
}
456
457
}
Original file line number Diff line number Diff line change @@ -31,13 +31,14 @@ public struct UInt128: Sendable {
31
31
@available ( SwiftStdlib 6 . 0 , * )
32
32
@_transparent
33
33
public var _low : UInt64 {
34
- UInt64 ( truncatingIfNeeded : self )
34
+ UInt64 ( Builtin . trunc_Int128_Int64 ( _value ) )
35
35
}
36
36
37
37
@available ( SwiftStdlib 6 . 0 , * )
38
- @_transparent @ usableFromInline
38
+ @_transparent
39
39
public var _high : UInt64 {
40
- UInt64 ( truncatingIfNeeded: self &>> 64 )
40
+ let shifted : UInt128 = self &>> 64
41
+ return UInt64 ( Builtin . trunc_Int128_Int64 ( shifted. _value) )
41
42
}
42
43
43
44
@available ( SwiftStdlib 6 . 0 , * )
@@ -385,7 +386,7 @@ extension UInt128: BinaryInteger {
385
386
386
387
@available ( SwiftStdlib 6 . 0 , * )
387
388
@_transparent
388
- init ( _value: UInt128 ) {
389
+ public init ( _value: UInt128 ) {
389
390
self . _value = _value
390
391
}
391
392
}
@@ -442,7 +443,7 @@ extension UInt128: BinaryInteger {
442
443
#elseif _pointerBitWidth(_32)
443
444
UInt ( Builtin . trunc_Int128_Int32 ( _value) )
444
445
#else
445
- UInt ( truncatingIfNeeded : self )
446
+ #error("Unsupported platform" )
446
447
#endif
447
448
}
448
449
}
You can’t perform that action at this time.
0 commit comments