     buffer._bitCount = buffer._bitCount &- scalarBitCount
 
     if _fastPath(isValid) { return .valid(encodedScalar) }
-    return .invalid(length: Int(scalarBitCount &>> 3))
-  }
+    return .invalid(
+      length: Int(scalarBitCount / numericCast(CodeUnit.bitWidth)))
+  }
+}
+
+//===----------------------------------------------------------------------===//
+//===--- UTF8 Decoders ----------------------------------------------------===//
+//===----------------------------------------------------------------------===//
+
+public protocol _UTF8Decoder : _UTFDecoder {
+  var buffer: Buffer { get set }
+}
+
+extension _UTF8Decoder {
+  public static func _isScalar(_ x: CodeUnit) -> Bool { return x & 0x80 == 0 }
 }
 
 extension Unicode.UTF8 : UnicodeEncoding {

      }
      // Non-ASCII, proceed to buffering mode.
      buffer.append(codeUnit)
    } else if buffer._storage & 0x80 == 0 {
      // ASCII in buffer.  We don't refill the buffer so we can return
      // to bufferless mode once we've exhausted it.
      let codeUnit = CodeUnit(extendingOrTruncating: buffer._storage)

  var buffer: Buffer { get set }
}

extension _UTFDecoder {
  public mutating func parseOne<I : IteratorProtocol>(
    _ input: inout I
  ) -> Unicode.ParseResult<EncodedScalar>
    where I.Element == CodeUnit {

    // Bufferless single-scalar fastpath.
    if _fastPath(buffer.isEmpty) {
      guard let codeUnit = input.next() else { return .emptyInput }
      // ASCII, return immediately.
