`maskingShiftLeft(by:)`, `maskingShiftRight(by:)` and
`resizingShiftLeft(by:)` handle a negative amount by negating it and
shifting the other way, so `Int.min` trapped with an arithmetic
overflow. All three have a defined result for it: an amount of at least
`count` clears or removes every value, which is what `Int.min + 1`
already did.
Clamp the magnitude of a negative amount to `Int.max` in these three.
`resizingShiftRight(by:)` is left alone: a negative amount inserts
values there, and no array can hold as many as `Int.min` asks for.
The masking shifts had no tests. Add tests for both of them over
word-crossing counts and amounts on either side of `count`, for their
doc examples, and for the extreme amounts.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
_resizingShiftRight(by:) copied the surviving suffix down to index 0 and
then removed `count &- amount` trailing bits instead of `amount`, so it
truncated the result to `amount` stale bits rather than keeping
`count - amount` valid ones. resizingShiftLeft(by: -n) was affected via
the same path, and the API had no test coverage at all.
Also fix the doc examples, which demonstrated the resizing shifts with
the masking shift function names (and, in one case, a result whose bit
count contradicted the documented growth by `amount`).
Add regression tests asserting parity with the documented semantics
(dropFirst / prepending false values) across word-boundary counts,
negative amounts, boundary `amount` values, and the doc examples
verbatim.