     }
 
     // We have a well-formed surrogate pair, decode it.
-    let result = 0x10000 + ((UInt32(unit0 & 0x03ff) &<< 10) | UInt32(unit1 & 0x03ff))
+    let result = 0x10000 + (
+      (UInt32(extendingOrTruncating: unit0 & 0x03ff) &<< 10) |
+      UInt32(extendingOrTruncating: 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: UInt32(unit0)))
    }

    // Ensure `unit0` is a high-surrogate.

  /// - 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
