mirror of
https://github.com/apple/swift-numerics
synced 2026-11-24 04:38:11 +00:00
Integer Utilities
Utilities defined for BinaryInteger
The following API are defined for all integer types conforming to BinaryInteger:
-
The
gcd(_:_:)free function implements the Greatest Common Divisor operation. -
The
shifted(right:rounding:)method implements bitwise shift with rounding.
Utilities defined for FixedWidthInteger
- The
rotated(right:)androtated(left:)methods implement bitwise rotation for signed and unsigned integer types. The count parameter may be anyBinaryIntegertype.
Types
The RoundingRule enum is used with shift, division, and round operations
to specify how to round their results to a representable value.