     }
 
     // We have a well-formed surrogate pair, decode it.
-    let result = 0x10000 + (((unit0 & 0x03ff) << 10) | (unit1 & 0x03ff))
+    let result = 0x10000 + ((UInt32(unit0 & 0x03ff) << 10) | UInt32(unit1 & 0x03ff))
     return .scalarValue(UnicodeScalar(_unchecked: result))
   }
 


    // Common case first, non-surrogate -- just a sequence of 1 code unit.
    if _fastPath((unit0 >> 11) != 0b1101_1) {
      return .scalarValue(UnicodeScalar(_unchecked: unit0))
    }

    // Ensure `unit0` is a high-surrogate.
    guard _fastPath((unit0 >> 10) == 0b1101_10) else { return .error }

    // We already have a high-surrogate, so there should be a next code unit.
    guard let next = input.next() else { return .error }
    let unit1 = UInt32(next)

    // `unit0` is a high-surrogate, so `unit1` should be a low-surrogate.
    guard _fastPath((unit1 >> 10) == 0b1101_11) else {

  public init() {}

  /// A lookahead buffer for one UTF-16 code unit.
  internal var _decodeLookahead: UInt16?

  /// Starts or continues decoding a UTF-16 sequence.
  ///
