         return .valid(UInt32(codeUnit), length: 1)
       }
       // Non-ASCII, proceed to buffering mode.
-      _buffer = UInt32(extendingOrTruncating: codeUnit)
+      _bufferStorage = UInt32(extendingOrTruncating: codeUnit)
       _bitsInBuffer = 8
-    } else if _buffer & 0x80 == 0 {
+    } else if _bufferStorage & 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 = _buffer & 0xff
-      _buffer &>>= 8
+      let codeUnit = _bufferStorage & 0xff
+      _bufferStorage &>>= 8
       _bitsInBuffer = _bitsInBuffer &- 8
       return .valid(codeUnit, length: 1)
     }

  public // @testable
  func _validateBuffer() -> (valid: Bool, length: UInt8) {
    // FIXME: is this check eliminated when inlined into parseOne?
    if _buffer & 0x80 == 0 {
      return (true, 1)
    }

    if _buffer                & 0b0__1110_0000__1100_0000
                             == 0b0__1100_0000__1000_0000 {
      // 2-byte sequence.  Top 4 bits of decoded result must be nonzero
      let top4Bits =  _buffer & 0b0__0001_1110__0000_0000
      if _fastPath(top4Bits != 0) { return (true, 2) }
    }
    else if _buffer           & 0b0__1111_0000__1100_0000__1100_0000
                             == 0b0__1110_0000__1000_0000__1000_0000 {
      // 3-byte sequence. The top 5 bits of the decoded result must be nonzero
      // and not a surrogate
      let top5Bits = _buffer &       0b0__1111__0010_0000__0000_0000
      if _fastPath(
        top5Bits != 0 && top5Bits != 0b0__1101__0010_0000__0000_0000) {
        return (true, 3)
      }
    }
    else if _buffer          & 0b0__1111_1000__1100_0000__1100_0000__1100_0000
                            == 0b0__1111_0000__1000_0000__1000_0000__1000_0000 {
      // Make sure the top 5 bits of the decoded result would be in range
      let top5bits =      _buffer & 0b0__0111__0011_0000__0000_0000__0000_0000
      if _fastPath(
        top5bits != 0
        && top5bits <=              0b0__0100__0000_0000__0000_0000__0000_0000


extension Unicode.UTF8 : UnicodeEncoding {
  public struct ForwardDecoder {
    public init() { _bufferStorage = 0; _bitsInBuffer = 0 }
    var _bufferStorage: UInt32
    var _bitsInBuffer: UInt8
  }

  public struct ReverseDecoder {
    public init() { _bufferStorage = 0; _bitsInBuffer = 0 }
    var _bufferStorage: UInt32
    var _bitsInBuffer: UInt8
  }
}
