|
@@ -84,10 +84,11 @@ protected:
|
|
unsigned char LongFractWidth, LongFractAlign;
|
|
unsigned char LongFractWidth, LongFractAlign;
|
|
|
|
|
|
// If true, unsigned fixed point types have the same number of fractional bits
|
|
// If true, unsigned fixed point types have the same number of fractional bits
|
|
- // as their signed counterparts. Otherwise, unsigned fixed point types have
|
|
|
|
|
|
+ // as their signed counterparts, forcing the unsigned types to have one extra
|
|
|
|
+ // bit of padding. Otherwise, unsigned fixed point types have
|
|
// one more fractional bit than its corresponding signed type. This is false
|
|
// one more fractional bit than its corresponding signed type. This is false
|
|
// by default.
|
|
// by default.
|
|
- bool SameFBits;
|
|
|
|
|
|
+ bool PaddingOnUnsignedFixedPoint;
|
|
|
|
|
|
// Fixed point integral and fractional bit sizes
|
|
// Fixed point integral and fractional bit sizes
|
|
// Saturated types share the same integral/fractional bits as their
|
|
// Saturated types share the same integral/fractional bits as their
|
|
@@ -95,7 +96,7 @@ protected:
|
|
// For simplicity, the fractional bits in a _Fract type will be one less the
|
|
// For simplicity, the fractional bits in a _Fract type will be one less the
|
|
// width of that _Fract type. This leaves all signed _Fract types having no
|
|
// width of that _Fract type. This leaves all signed _Fract types having no
|
|
// padding and unsigned _Fract types will only have 1 bit of padding after the
|
|
// padding and unsigned _Fract types will only have 1 bit of padding after the
|
|
- // sign if SameFBits is set.
|
|
|
|
|
|
+ // sign if PaddingOnUnsignedFixedPoint is set.
|
|
unsigned char ShortAccumScale;
|
|
unsigned char ShortAccumScale;
|
|
unsigned char AccumScale;
|
|
unsigned char AccumScale;
|
|
unsigned char LongAccumScale;
|
|
unsigned char LongAccumScale;
|
|
@@ -436,30 +437,33 @@ public:
|
|
/// getUnsignedShortAccumScale/IBits - Return the number of
|
|
/// getUnsignedShortAccumScale/IBits - Return the number of
|
|
/// fractional/integral bits in a 'unsigned short _Accum' type.
|
|
/// fractional/integral bits in a 'unsigned short _Accum' type.
|
|
unsigned getUnsignedShortAccumScale() const {
|
|
unsigned getUnsignedShortAccumScale() const {
|
|
- return SameFBits ? ShortAccumScale : ShortAccumScale + 1;
|
|
|
|
|
|
+ return PaddingOnUnsignedFixedPoint ? ShortAccumScale : ShortAccumScale + 1;
|
|
}
|
|
}
|
|
unsigned getUnsignedShortAccumIBits() const {
|
|
unsigned getUnsignedShortAccumIBits() const {
|
|
- return SameFBits ? getShortAccumIBits()
|
|
|
|
- : ShortAccumWidth - getUnsignedShortAccumScale();
|
|
|
|
|
|
+ return PaddingOnUnsignedFixedPoint
|
|
|
|
+ ? getShortAccumIBits()
|
|
|
|
+ : ShortAccumWidth - getUnsignedShortAccumScale();
|
|
}
|
|
}
|
|
|
|
|
|
/// getUnsignedAccumScale/IBits - Return the number of fractional/integral
|
|
/// getUnsignedAccumScale/IBits - Return the number of fractional/integral
|
|
/// bits in a 'unsigned _Accum' type.
|
|
/// bits in a 'unsigned _Accum' type.
|
|
unsigned getUnsignedAccumScale() const {
|
|
unsigned getUnsignedAccumScale() const {
|
|
- return SameFBits ? AccumScale : AccumScale + 1;
|
|
|
|
|
|
+ return PaddingOnUnsignedFixedPoint ? AccumScale : AccumScale + 1;
|
|
}
|
|
}
|
|
unsigned getUnsignedAccumIBits() const {
|
|
unsigned getUnsignedAccumIBits() const {
|
|
- return SameFBits ? getAccumIBits() : AccumWidth - getUnsignedAccumScale();
|
|
|
|
|
|
+ return PaddingOnUnsignedFixedPoint ? getAccumIBits()
|
|
|
|
+ : AccumWidth - getUnsignedAccumScale();
|
|
}
|
|
}
|
|
|
|
|
|
/// getUnsignedLongAccumScale/IBits - Return the number of fractional/integral
|
|
/// getUnsignedLongAccumScale/IBits - Return the number of fractional/integral
|
|
/// bits in a 'unsigned long _Accum' type.
|
|
/// bits in a 'unsigned long _Accum' type.
|
|
unsigned getUnsignedLongAccumScale() const {
|
|
unsigned getUnsignedLongAccumScale() const {
|
|
- return SameFBits ? LongAccumScale : LongAccumScale + 1;
|
|
|
|
|
|
+ return PaddingOnUnsignedFixedPoint ? LongAccumScale : LongAccumScale + 1;
|
|
}
|
|
}
|
|
unsigned getUnsignedLongAccumIBits() const {
|
|
unsigned getUnsignedLongAccumIBits() const {
|
|
- return SameFBits ? getLongAccumIBits()
|
|
|
|
- : LongAccumWidth - getUnsignedLongAccumScale();
|
|
|
|
|
|
+ return PaddingOnUnsignedFixedPoint
|
|
|
|
+ ? getLongAccumIBits()
|
|
|
|
+ : LongAccumWidth - getUnsignedLongAccumScale();
|
|
}
|
|
}
|
|
|
|
|
|
/// getShortFractScale - Return the number of fractional bits
|
|
/// getShortFractScale - Return the number of fractional bits
|
|
@@ -477,19 +481,21 @@ public:
|
|
/// getUnsignedShortFractScale - Return the number of fractional bits
|
|
/// getUnsignedShortFractScale - Return the number of fractional bits
|
|
/// in a 'unsigned short _Fract' type.
|
|
/// in a 'unsigned short _Fract' type.
|
|
unsigned getUnsignedShortFractScale() const {
|
|
unsigned getUnsignedShortFractScale() const {
|
|
- return SameFBits ? getShortFractScale() : getShortFractScale() + 1;
|
|
|
|
|
|
+ return PaddingOnUnsignedFixedPoint ? getShortFractScale()
|
|
|
|
+ : getShortFractScale() + 1;
|
|
}
|
|
}
|
|
|
|
|
|
/// getUnsignedFractScale - Return the number of fractional bits
|
|
/// getUnsignedFractScale - Return the number of fractional bits
|
|
/// in a 'unsigned _Fract' type.
|
|
/// in a 'unsigned _Fract' type.
|
|
unsigned getUnsignedFractScale() const {
|
|
unsigned getUnsignedFractScale() const {
|
|
- return SameFBits ? getFractScale() : getFractScale() + 1;
|
|
|
|
|
|
+ return PaddingOnUnsignedFixedPoint ? getFractScale() : getFractScale() + 1;
|
|
}
|
|
}
|
|
|
|
|
|
/// getUnsignedLongFractScale - Return the number of fractional bits
|
|
/// getUnsignedLongFractScale - Return the number of fractional bits
|
|
/// in a 'unsigned long _Fract' type.
|
|
/// in a 'unsigned long _Fract' type.
|
|
unsigned getUnsignedLongFractScale() const {
|
|
unsigned getUnsignedLongFractScale() const {
|
|
- return SameFBits ? getLongFractScale() : getLongFractScale() + 1;
|
|
|
|
|
|
+ return PaddingOnUnsignedFixedPoint ? getLongFractScale()
|
|
|
|
+ : getLongFractScale() + 1;
|
|
}
|
|
}
|
|
|
|
|
|
/// Determine whether the __int128 type is supported on this target.
|
|
/// Determine whether the __int128 type is supported on this target.
|