   public // @testable
   static func _toUTF16CodeUnit(_ x: UTF8.CodeUnit) -> UTF16.CodeUnit {
     _sanityCheck(x <= 0x7f, "should only be doing this with ASCII")
-    return UTF16.CodeUnit(x)
+    return UTF16.CodeUnit(extendingOrTruncating: x)
   }
   public // @testable
   static func _fromUTF16CodeUnit(
     _ utf16: UTF16.CodeUnit
   ) -> UTF8.CodeUnit {
     _sanityCheck(utf16 <= 0x7f, "should only be doing this with ASCII")
-    return UTF8.CodeUnit(utf16)
+    return UTF8.CodeUnit(extendingOrTruncating: utf16)
   }
 }
 

      if let codeUnit = input.next() {
        // We know _bitsInBuffer < 32 so we use `& 0x1f` (31) to make the
        // compiler omit a bounds check branch for the bitshift.
        _decodeBuffer |= (UInt32(codeUnit) &<< UInt32(_bitsInBuffer & 0x1f))
        _bitsInBuffer = _bitsInBuffer &+ 8
      } else {
        if _bitsInBuffer == 0 { return .emptyInput }

  /// - SeeAlso: `UTF16.width(_:)`, `UTF16.leadSurrogate(_:)`
  public static func trailSurrogate(_ x: UnicodeScalar) -> UTF16.CodeUnit {
    _precondition(width(x) == 2)
    return 0xDC00 + UTF16.CodeUnit(extendingOrTruncating:
      (x.value - 0x1_0000) & (((1 as UInt32) &<< 10) - 1))
  }

  /// Returns a Boolean value indicating whether the specified code unit is a
