The APFixedPoint class works similarly to APInt/APSInt in that it is a functional replacement for a scaled integer. It supports a wide range of semantics including the one used by fixed point types proposed in ISO/IEC JTC1 SC22 WG14 N1169. The class carries the value and semantics of a fixed point, and provides different operations that would normally be performed on fixed point types.
Synopsis
Declared in <llvm/ADT/APFixedPoint.h>
class APFixedPoint;
Member Functions
Name |
Description |
|
Constructors |
Add |
|
Compare against |
|
Convert this number to match the semantics provided. |
|
Convert this fixed point number to a floating point value with the provided semantics. |
|
Return the integral part of this fixed point number, rounded towards zero. The value is stored into an APSInt with the provided width and sign. If the overflow parameter is provided, and the integral value is not able to be fully stored in the provided width and sign, the overflow parameter is set to true. |
|
Divide by |
|
Dump this value to stderr for debugging. |
|
Return true if the underlying scaled integer is non‐zero. |
|
Return the integral part of this fixed point number, rounded towards zero. (‐2.5k ‐> ‐2) |
|
Return the LSB weight of this value's semantics. |
|
Return the MSB weight of this value's semantics. |
|
Return the fractional scale of this value's semantics. |
|
Return a copy of this value's fixed‐point semantics. |
|
Return the underlying scaled integer with matching signedness. |
|
Return the bit width of this value's semantics. |
|
Return true if unsigned semantics reserve a padding bit. |
|
Return true if this value's semantics saturate on overflow. |
|
Return true if this value uses a signed representation. |
|
Multiply by |
|
Perform a unary negation (‐X) on this fixed point type, taking into account saturation if applicable. |
|
Write a human‐readable representation to |
|
Left‐shift the scaled integer by |
|
Right‐shift the scaled integer by |
|
Subtract |
|
|
|
Return true if this value equals |
|
Return true if this value differs from |
|
Return true if this value is less than |
|
Return true if this value is less than or equal to |
|
Return true if this value is greater than |
|
Return true if this value is greater than or equal to |
Static Member Functions
Name |
Description |
Return the smallest positive quantum (epsilon) for semantics |
|
Create an APFixedPoint with a value equal to that of the provided floating point value, in the provided target semantics. If the value is not able to fit in the specified fixed point semantics and the overflow parameter is specified, it is set to true. For NaN, the Overflow flag is always set. For +inf and ‐inf, if the semantic is saturating, the value saturates. Otherwise, the Overflow flag is set. |
|
Create an APFixedPoint with a value equal to that of the provided integer, and in the same semantics as the provided target semantics. If the value is not able to fit in the specified fixed point semantics, and the overflow parameter is provided, it is set to true. |
|
Return the maximum representable value for semantics |
|
Return the minimum representable value for semantics |
|
Given a floating point semantic, return the next floating point semantic with a larger exponent and larger or equal mantissa. |
Non-Member Functions
Name |
Description |
Compute a hash code for fixed‐point value |
Created with MrDocs