FastLED 3.9.15
Loading...
Searching...
No Matches

◆ ClipToShort()

static __inline short fl::third_party::ClipToShort ( int x,
int fracBits )
static

Definition at line 74 of file polyphase.hpp.

75{
76 int32_t x32 = (int32_t)x;
78
79 /* assumes you've already rounded (x += (1 << (fracBits-1))) */
80 x32 >>= fracBits;
81
82 /* Ken's trick: clips to [-32768, 32767] */
83 sign = x32 >> 31;
84 if (sign != (x32 >> 15))
85 x32 = sign ^ ((1L << 15) - 1);
86
87 return (short)x32;
88}
fl::i32 int32_t
Definition coder.h:220
constexpr enable_if< is_fixed_point< T >::value, int >::type sign(T x) FL_NOEXCEPT

References FL_NOEXCEPT, fl::sign(), and fl::x.

Referenced by PolyphaseMono(), and PolyphaseStereo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: