Skip to content

Commit ee08dc9

Browse files
authored
Merge pull request #41586 from stephentyrone/order-of-operations-is-hard
|| has higher precedence than the ternary operator
2 parents 57af818 + b520063 commit ee08dc9

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

stdlib/public/core/UnsafePointer.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,10 @@ public struct UnsafePointer<Pointee>: _Pointer {
316316
_debugPrecondition(
317317
Int(bitPattern: .init(_rawValue)) & (MemoryLayout<T>.alignment-1) == 0 &&
318318
( count == 1 ||
319-
MemoryLayout<Pointee>.stride > MemoryLayout<T>.stride
320-
? MemoryLayout<Pointee>.stride % MemoryLayout<T>.stride == 0
321-
: MemoryLayout<T>.stride % MemoryLayout<Pointee>.stride == 0 )
322-
)
319+
( MemoryLayout<Pointee>.stride > MemoryLayout<T>.stride
320+
? MemoryLayout<Pointee>.stride % MemoryLayout<T>.stride == 0
321+
: MemoryLayout<T>.stride % MemoryLayout<Pointee>.stride == 0
322+
)))
323323
let binding = Builtin.bindMemory(_rawValue, count._builtinWordValue, T.self)
324324
defer { Builtin.rebindMemory(_rawValue, binding) }
325325
return try body(.init(_rawValue))
@@ -1003,10 +1003,10 @@ public struct UnsafeMutablePointer<Pointee>: _Pointer {
10031003
_debugPrecondition(
10041004
Int(bitPattern: .init(_rawValue)) & (MemoryLayout<T>.alignment-1) == 0 &&
10051005
( count == 1 ||
1006-
MemoryLayout<Pointee>.stride > MemoryLayout<T>.stride
1007-
? MemoryLayout<Pointee>.stride % MemoryLayout<T>.stride == 0
1008-
: MemoryLayout<T>.stride % MemoryLayout<Pointee>.stride == 0 )
1009-
)
1006+
( MemoryLayout<Pointee>.stride > MemoryLayout<T>.stride
1007+
? MemoryLayout<Pointee>.stride % MemoryLayout<T>.stride == 0
1008+
: MemoryLayout<T>.stride % MemoryLayout<Pointee>.stride == 0
1009+
)))
10101010
let binding = Builtin.bindMemory(_rawValue, count._builtinWordValue, T.self)
10111011
defer { Builtin.rebindMemory(_rawValue, binding) }
10121012
return try body(.init(_rawValue))

0 commit comments

Comments
 (0)