@@ -116,13 +116,41 @@ extension _Pointer /*: Equatable */ {
116116 public static func == ( lhs: Self , rhs: Self ) -> Bool {
117117 return Bool ( Builtin . cmp_eq_RawPointer ( lhs. _rawValue, rhs. _rawValue) )
118118 }
119+
120+ /// Returns a Boolean value indicating whether two pointers represent
121+ /// the same memory address.
122+ ///
123+ /// - Parameters:
124+ /// - lhs: A pointer.
125+ /// - rhs: Another pointer.
126+ /// - Returns: `true` if `lhs` and `rhs` reference the same memory address;
127+ /// otherwise, `false`.
128+ @inlinable
129+ @_alwaysEmitIntoClient
130+ public static func == < Other: _Pointer > ( lhs: Self , rhs: Other ) -> Bool {
131+ return Bool ( Builtin . cmp_eq_RawPointer ( lhs. _rawValue, rhs. _rawValue) )
132+ }
133+
134+ /// Returns a Boolean value indicating whether two pointers represent
135+ /// different memory addresses.
136+ ///
137+ /// - Parameters:
138+ /// - lhs: A pointer.
139+ /// - rhs: Another pointer.
140+ /// - Returns: `true` if `lhs` and `rhs` reference different memory addresses;
141+ /// otherwise, `false`.
142+ @inlinable
143+ @_alwaysEmitIntoClient
144+ public static func != < Other: _Pointer > ( lhs: Self , rhs: Other ) -> Bool {
145+ return Bool ( Builtin . cmp_ne_RawPointer ( lhs. _rawValue, rhs. _rawValue) )
146+ }
119147}
120148
121149extension _Pointer /*: Comparable */ {
122150 // - Note: This is an unsigned comparison unlike Strideable's
123151 // implementation.
124152 /// Returns a Boolean value indicating whether the first pointer references
125- /// an earlier memory location than the second pointer.
153+ /// a memory location earlier than the second pointer references .
126154 ///
127155 /// - Parameters:
128156 /// - lhs: A pointer.
@@ -133,6 +161,62 @@ extension _Pointer /*: Comparable */ {
133161 public static func < ( lhs: Self , rhs: Self ) -> Bool {
134162 return Bool ( Builtin . cmp_ult_RawPointer ( lhs. _rawValue, rhs. _rawValue) )
135163 }
164+
165+ /// Returns a Boolean value indicating whether the first pointer references
166+ /// a memory location earlier than the second pointer references.
167+ ///
168+ /// - Parameters:
169+ /// - lhs: A pointer.
170+ /// - rhs: Another pointer.
171+ /// - Returns: `true` if `lhs` references a memory address
172+ /// earlier than `rhs`; otherwise, `false`.
173+ @inlinable
174+ @_alwaysEmitIntoClient
175+ public static func < < Other: _Pointer > ( lhs: Self , rhs: Other ) -> Bool {
176+ return Bool ( Builtin . cmp_ult_RawPointer ( lhs. _rawValue, rhs. _rawValue) )
177+ }
178+
179+ /// Returns a Boolean value indicating whether the first pointer references
180+ /// a memory location earlier than or same as the second pointer references.
181+ ///
182+ /// - Parameters:
183+ /// - lhs: A pointer.
184+ /// - rhs: Another pointer.
185+ /// - Returns: `true` if `lhs` references a memory address
186+ /// earlier than or the same as `rhs`; otherwise, `false`.
187+ @inlinable
188+ @_alwaysEmitIntoClient
189+ public static func <= < Other: _Pointer > ( lhs: Self , rhs: Other ) -> Bool {
190+ return Bool ( Builtin . cmp_ule_RawPointer ( lhs. _rawValue, rhs. _rawValue) )
191+ }
192+
193+ /// Returns a Boolean value indicating whether the first pointer references
194+ /// a memory location later than the second pointer references.
195+ ///
196+ /// - Parameters:
197+ /// - lhs: A pointer.
198+ /// - rhs: Another pointer.
199+ /// - Returns: `true` if `lhs` references a memory address
200+ /// later than `rhs`; otherwise, `false`.
201+ @inlinable
202+ @_alwaysEmitIntoClient
203+ public static func > < Other: _Pointer > ( lhs: Self , rhs: Other ) -> Bool {
204+ return Bool ( Builtin . cmp_ugt_RawPointer ( lhs. _rawValue, rhs. _rawValue) )
205+ }
206+
207+ /// Returns a Boolean value indicating whether the first pointer references
208+ /// a memory location later than or same as the second pointer references.
209+ ///
210+ /// - Parameters:
211+ /// - lhs: A pointer.
212+ /// - rhs: Another pointer.
213+ /// - Returns: `true` if `lhs` references a memory address
214+ /// later than or the same as `rhs`; otherwise, `false`.
215+ @inlinable
216+ @_alwaysEmitIntoClient
217+ public static func >= < Other: _Pointer > ( lhs: Self , rhs: Other ) -> Bool {
218+ return Bool ( Builtin . cmp_uge_RawPointer ( lhs. _rawValue, rhs. _rawValue) )
219+ }
136220}
137221
138222extension _Pointer /*: Strideable*/ {
0 commit comments