       return 0
     }
 
+    // The relative position (offset) to the last code unit.
+    let lastOffset = end._position - _coreOffset - 1
+    // The relative position (offset) that is one-past-the-last
+    let endOffset = lastOffset + 1
+
     // Grapheme breaking is much simpler if known ASCII
     if _core.isASCII {
       _onFastPath() // Please aggressively inline
       let asciiBuffer = _core.asciiBuffer._unsafelyUnwrappedUnchecked
-      let pos = end._position - _coreOffset - 1
       _sanityCheck(
-        pos >= asciiBuffer.startIndex,
+        lastOffset >= asciiBuffer.startIndex,
         "should of been caught in earlier start-of-scalars check")
 
       // With the exception of CR-LF, ASCII graphemes are single-scalar. Check
       // for that one exception.
       if _slowPath(
-        asciiBuffer[pos] == _LF &&
-        pos-1 >= asciiBuffer.startIndex &&
-        asciiBuffer[pos-1] == _CR
+        asciiBuffer[lastOffset] == _LF &&
+        lastOffset-1 >= asciiBuffer.startIndex &&
+        asciiBuffer[lastOffset-1] == _CR
       ) {
         return 2
       }

internal let _CR: UInt8 = 0x0d
internal let _LF: UInt8 = 0x0a

extension String {
  /// A view of a string's contents as a collection of characters.
  ///

  internal func _measureExtendedGraphemeClusterForward(
    from start: UnicodeScalarView.Index
  ) -> Int {
    let end = unicodeScalars.endIndex
    if start == end {
      return 0
    }

    // Our relative position (offset). If our _core is not a substring, this is
    // the same as start._position.
    let relativeOffset = start._position - _coreOffset

    // Grapheme breaking is much simpler if known ASCII
    if _core.isASCII {
      _onFastPath() // Please aggressively inline
      let asciiBuffer = _core.asciiBuffer._unsafelyUnwrappedUnchecked

      // With the exception of CR-LF, ASCII graphemes are single-scalar. Check
      // for that one exception.
      if _slowPath(
        asciiBuffer[relativeOffset] == _CR &&
        relativeOffset+1 < asciiBuffer.endIndex &&
        asciiBuffer[relativeOffset+1] == _LF
      ) {
        return 2
      }

      return 1
    } else {
      // TODO: Check for (potentially non-contiguous) ASCII NSStrings,
      // especially small tagged pointers.
    }
    
    let startIndexUTF16 = start._position
