@@ -486,66 +486,65 @@ extension ${Self} : CustomPlaygroundQuickLookable {
486
486
}
487
487
}
488
488
489
- // - Note: Strideable's implementation is potentially less efficient and cannot
490
- // handle misaligned pointers.
491
- @_transparent
492
- public func == < Pointee> (
493
- lhs: ${ Self} < Pointee> , rhs: ${ Self} < Pointee>
494
- ) - > Bool {
495
- return Bool ( Builtin . cmp_eq_RawPointer ( lhs. _rawValue, rhs. _rawValue) )
496
- }
489
+ extension ${ Self} {
490
+ // - Note: Strideable's implementation is potentially less efficient and cannot
491
+ // handle misaligned pointers.
492
+ @_transparent
493
+ public static func == ( lhs: ${ Self} < Pointee> , rhs: ${ Self} < Pointee> ) -> Bool {
494
+ return Bool ( Builtin . cmp_eq_RawPointer ( lhs. _rawValue, rhs. _rawValue) )
495
+ }
497
496
498
- // - Note: Strideable's implementation is potentially less efficient and cannot
499
- // handle misaligned pointers.
500
- //
501
- // - Note: This is an unsigned comparison unlike Strideable's implementation.
502
- @_transparent
503
- public func < < Pointee > ( lhs: ${ Self} < Pointee> , rhs: ${ Self} < Pointee> ) - > Bool {
504
- return Bool ( Builtin . cmp_ult_RawPointer ( lhs. _rawValue, rhs. _rawValue) )
505
- }
497
+ // - Note: Strideable's implementation is potentially less efficient and
498
+ // cannot handle misaligned pointers.
499
+ //
500
+ // - Note: This is an unsigned comparison unlike Strideable's implementation.
501
+ @_transparent
502
+ public static func < ( lhs: ${ Self} < Pointee> , rhs: ${ Self} < Pointee> ) -> Bool {
503
+ return Bool ( Builtin . cmp_ult_RawPointer ( lhs. _rawValue, rhs. _rawValue) )
504
+ }
506
505
507
- // - Note: The following family of operator overloads are redundant
508
- // with Strideable. However, optimizer improvements are needed
509
- // before they can be removed without affecting performance.
506
+ // - Note: The following family of operator overloads are redundant
507
+ // with Strideable. However, optimizer improvements are needed
508
+ // before they can be removed without affecting performance.
510
509
511
- /// - Precondition: The result is within bounds of the same allocation.
512
- @_transparent
513
- public func + < Pointee > ( lhs: ${ Self} < Pointee> , rhs: Int) - > ${ Self} < Pointee> {
514
- return ${ Self} ( Builtin . gep_Word (
515
- lhs. _rawValue, rhs. _builtinWordValue, Pointee . self) )
516
- }
510
+ /// - Precondition: The result is within bounds of the same allocation.
511
+ @_transparent
512
+ public static func + ( lhs: ${ Self} < Pointee> , rhs: Int) -> ${ Self} < Pointee> {
513
+ return ${ Self} ( Builtin. gep_Word(
514
+ lhs. _rawValue, rhs. _builtinWordValue, Pointee . self) )
515
+ }
517
516
518
- /// - Precondition: The result is within the bounds of the same allocation.
519
- @_transparent
520
- public func + < Pointee> ( lhs: Int,
521
- rhs: ${ Self} < Pointee> ) - > ${ Self} < Pointee> {
522
- return rhs + lhs
523
- }
517
+ /// - Precondition: The result is within the bounds of the same allocation.
518
+ @_transparent
519
+ public static func + ( lhs: Int, rhs: ${ Self} < Pointee> ) - > ${ Self} < Pointee> {
520
+ return rhs + lhs
521
+ }
524
522
525
- /// - Precondition: The result is within the bounds of the same allocation.
526
- @_transparent
527
- public func - < Pointee > ( lhs: ${ Self} < Pointee> , rhs: Int) - > ${ Self} < Pointee> {
528
- return lhs + - rhs
529
- }
523
+ /// - Precondition: The result is within the bounds of the same allocation.
524
+ @_transparent
525
+ public static func - ( lhs: ${ Self} < Pointee> , rhs: Int) - > ${ Self} < Pointee> {
526
+ return lhs + - rhs
527
+ }
530
528
531
- @_transparent
532
- public func - < Pointee > ( lhs: ${ Self} < Pointee> , rhs: ${ Self} < Pointee> ) - > Int {
533
- return
534
- Int ( Builtin . sub_Word ( Builtin . ptrtoint_Word ( lhs. _rawValue) ,
535
- Builtin . ptrtoint_Word ( rhs. _rawValue) ) )
536
- / MemoryLayout< Pointee> . stride
537
- }
529
+ @_transparent
530
+ public static func - ( lhs: ${ Self} < Pointee> , rhs: ${ Self} < Pointee> ) - > Int {
531
+ return
532
+ Int ( Builtin . sub_Word ( Builtin . ptrtoint_Word ( lhs. _rawValue) ,
533
+ Builtin . ptrtoint_Word ( rhs. _rawValue) ) )
534
+ / MemoryLayout< Pointee> . stride
535
+ }
538
536
539
- /// - Precondition: The result is within the bounds of the same allocation.
540
- @_transparent
541
- public func += < Pointee > ( lhs: inout ${ Self} < Pointee> , rhs: Int) {
542
- lhs = lhs + rhs
543
- }
537
+ /// - Precondition: The result is within the bounds of the same allocation.
538
+ @_transparent
539
+ public static func += ( lhs: inout ${ Self} < Pointee> , rhs: Int) {
540
+ lhs = lhs + rhs
541
+ }
544
542
545
- /// - Precondition: The result is within the bounds of the same allocation.
546
- @_transparent
547
- public func -= < Pointee> ( lhs: inout ${ Self} < Pointee> , rhs: Int) {
548
- lhs = lhs - rhs
543
+ /// - Precondition: The result is within the bounds of the same allocation.
544
+ @_transparent
545
+ public static func -= ( lhs: inout ${ Self} < Pointee> , rhs: Int) {
546
+ lhs = lhs - rhs
547
+ }
549
548
}
550
549
551
550
extension ${ Self} {
0 commit comments