   /// buffer.
   @inline(never)
   func _invalidLength() -> UInt8 {
-    if _buffer & 0b0__1100_0000__1111_0000
-              == 0b0__1000_0000__1110_0000 {
+    if _bufferStorage & 0b0__1100_0000__1111_0000
+                     == 0b0__1000_0000__1110_0000 {
       // 2-byte prefix of 3-byte sequence. The top 5 bits of the decoded result
       // must be nonzero and not a surrogate
-      let top5Bits = _buffer        & 0b0__0010_0000__0000_1111
+      let top5Bits = _bufferStorage & 0b0__0010_0000__0000_1111
       if top5Bits != 0 && top5Bits != 0b0__0010_0000__0000_1101 { return 2 }
     }
-    else if _buffer & 0b0__1100_0000__1111_1000
-                   == 0b0__1000_0000__1111_0000
+    else if _bufferStorage & 0b0__1100_0000__1111_1000
+                          == 0b0__1000_0000__1111_0000
     {
       // Prefix of 4-byte sequence. The top 5 bits of the decoded result
       // must be nonzero and no greater than 0b0__0100_0000
-      let top5bits = UInt16(_buffer & 0b0__0011_0000__0000_0111).byteSwapped
-      if top5bits != 0 && top5bits <= 0b0__0000_0100__0000_0000 {
-        return _buffer & 0b0__1100_0000__0000_0000__0000_0000
-                     ==  0b0__1000_0000__0000_0000__0000_0000 ? 3 : 2
+      let top5bits = UInt16(_bufferStorage & 0b0__0011_0000__0000_0111).byteSwapped
+      if top5bits != 0 && top5bits        <= 0b0__0000_0100__0000_0000 {
+        return _bufferStorage   & 0b0__1100_0000__0000_0000__0000_0000
+                               == 0b0__1000_0000__0000_0000__0000_0000 ? 3 : 2
       }
     }
     return 1
   }
   
-  public static func scalar(buffer: UInt32, length: Int) -> UnicodeScalar {
+  public static func scalar(bufferStorage: UInt32, length: Int) -> UnicodeScalar {
     switch length {
     case 1:
-      return UnicodeScalar(_unchecked: buffer & 0xff)
+      return UnicodeScalar(_unchecked: bufferStorage & 0xff)
     case 2:
-      var value = (buffer & 0b0_______________________11_1111__0000_0000) &>> 8
-      value    |= (buffer & 0b0________________________________0001_1111) &<< 6
+      var value = (bufferStorage & 0b0_______________________11_1111__0000_0000) &>> 8
+      value    |= (bufferStorage & 0b0________________________________0001_1111) &<< 6
       return UnicodeScalar(_unchecked: value)
     case 3:
-      var value = (buffer & 0b0____________11_1111__0000_0000__0000_0000) &>> 16
-      value    |= (buffer & 0b0_______________________11_1111__0000_0000) &>> 2
-      value    |= (buffer & 0b0________________________________0000_1111) &<< 12
+      var value = (bufferStorage & 0b0____________11_1111__0000_0000__0000_0000) &>> 16
+      value    |= (bufferStorage & 0b0_______________________11_1111__0000_0000) &>> 2
+      value    |= (bufferStorage & 0b0________________________________0000_1111) &<< 12
       return UnicodeScalar(_unchecked: value)
     default:
       _sanityCheck(length == 4)
-      var value = (buffer & 0b0_11_1111__0000_0000__0000_0000__0000_0000) &>> 24
-      value    |= (buffer & 0b0____________11_1111__0000_0000__0000_0000) &>> 10
-      value    |= (buffer & 0b0_______________________11_1111__0000_0000) &<< 4
-      value    |= (buffer & 0b0________________________________0000_0111) &<< 18
+      var value = (bufferStorage & 0b0_11_1111__0000_0000__0000_0000__0000_0000) &>> 24
+      value    |= (bufferStorage & 0b0____________11_1111__0000_0000__0000_0000) &>> 10
+      value    |= (bufferStorage & 0b0_______________________11_1111__0000_0000) &<< 4
+      value    |= (bufferStorage & 0b0________________________________0000_0111) &<< 18
       return UnicodeScalar(_unchecked: value)
     }
   }

    // Consume the decoded bytes (or maximal subpart of ill-formed sequence).
    let bitsConsumed = 8 &* length
    _sanityCheck(1...4 ~= length && bitsConsumed <= _bitsInBuffer)
    let savedBuffer = _buffer
    
    _buffer = UInt32(
      // widen to 64 bits so that we can empty the buffer in the 4-byte case
      extendingOrTruncating: UInt64(_buffer) &>> bitsConsumed)
      
    _bitsInBuffer = _bitsInBuffer &- bitsConsumed



internal protocol _UTF8Decoder : UnicodeDecoder {
  init()
  var _bufferStorage: UInt32 { get set }
  var _bitsInBuffer: UInt8 { get set }
  
  func _validateBuffer() -> (valid: Bool, length: UInt8)
