Files
swift-numerics/Sources/IntegerUtilities
2021-09-26 21:54:32 -04:00
..
2021-09-26 21:54:32 -04:00
2021-09-09 23:05:45 -04:00
2021-09-26 21:54:32 -04:00
2021-09-26 21:54:32 -04:00
2021-09-26 21:54:32 -04: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:) and rotated(left:) methods implement bitwise rotation for signed and unsigned integer types. The count parameter may be any BinaryInteger type.

Types

The RoundingRule enum is used with shift, division, and round operations to specify how to round their results to a representable value.