Skip to content

Commit 6a5739f

Browse files
author
Max Moiseev
committed
Changing == and < on UnsafeRawPointer to static funcs
1 parent 5062490 commit 6a5739f

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

stdlib/public/core/UnsafeRawPointer.swift.gyb

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -473,17 +473,19 @@ public struct Unsafe${Mutable}RawPointer : Strideable, Hashable, _Pointer {
473473
}
474474
}
475475

476+
extension ${Self} {
476477
/// - Note: This may be more efficient than Strideable's implementation
477478
/// calling ${Self}.distance().
478-
@_transparent
479-
public func == (lhs: ${Self}, rhs: ${Self}) -> Bool {
480-
return Bool(Builtin.cmp_eq_RawPointer(lhs._rawValue, rhs._rawValue))
481-
}
479+
@_transparent
480+
public static func == (lhs: ${Self}, rhs: ${Self}) -> Bool {
481+
return Bool(Builtin.cmp_eq_RawPointer(lhs._rawValue, rhs._rawValue))
482+
}
482483

483-
/// - Note: This is an unsigned comparison unlike Strideable's implementation.
484-
@_transparent
485-
public func < (lhs: ${Self}, rhs: ${Self}) -> Bool {
486-
return Bool(Builtin.cmp_ult_RawPointer(lhs._rawValue, rhs._rawValue))
484+
/// - Note: This is an unsigned comparison unlike Strideable's implementation.
485+
@_transparent
486+
public static func < (lhs: ${Self}, rhs: ${Self}) -> Bool {
487+
return Bool(Builtin.cmp_ult_RawPointer(lhs._rawValue, rhs._rawValue))
488+
}
487489
}
488490

489491
extension Unsafe${Mutable}RawPointer : CustomDebugStringConvertible {

0 commit comments

Comments
 (0)