Skip to content

Commit 02186c3

Browse files
committed
Add saturate variants.
1 parent 8467099 commit 02186c3

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

libc/src/__support/fixed_point/fx_rep.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,24 @@ template <> struct FXRep<unsigned long accum> {
150150
LIBC_INLINE static constexpr Type EPS() { return ULACCUM_EPSILON; }
151151
};
152152

153+
template <> struct FXRep<short sat fract> : FXRep<short fract> {};
154+
template <> struct FXRep<sat fract> : FXRep<fract> {};
155+
template <> struct FXRep<long sat fract> : FXRep<long fract> {};
156+
template <>
157+
struct FXRep<unsigned short sat fract> : FXRep<unsigned short fract> {};
158+
template <> struct FXRep<unsigned sat fract> : FXRep<unsigned fract> {};
159+
template <>
160+
struct FXRep<unsigned long sat fract> : FXRep<unsigned long fract> {};
161+
162+
template <> struct FXRep<short sat accum> : FXRep<short accum> {};
163+
template <> struct FXRep<sat accum> : FXRep<accum> {};
164+
template <> struct FXRep<long sat accum> : FXRep<long accum> {};
165+
template <>
166+
struct FXRep<unsigned short sat accum> : FXRep<unsigned short accum> {};
167+
template <> struct FXRep<unsigned sat accum> : FXRep<unsigned accum> {};
168+
template <>
169+
struct FXRep<unsigned long sat accum> : FXRep<unsigned long accum> {};
170+
153171
} // namespace LIBC_NAMESPACE::fixed_point
154172

155173
#endif // LIBC_COMPILER_HAS_FIXED_POINT

0 commit comments

Comments
 (0)