Skip to content

Commit

Permalink
Merge branch 'XieJiSS-patch-1'
Browse files Browse the repository at this point in the history
Fix compilation on RISC-V and possibly other platforms.
  • Loading branch information
swesterfeld committed Nov 29, 2021
2 parents c59dd65 + 4c72be7 commit 6fded91
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lib/smmath.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ sm_math_init()
MathTables::ifreq2f_low[i] = sm_ifreq2freq_slow (ADD + i);
}

#if defined (__i386__) && defined (__GNUC__)
// ensure proper rounding mode
assert (sm_fpu_okround());
#endif

assert (sm_round_positive (42.51) == 43);
assert (sm_round_positive (3.14) == 3);
Expand All @@ -88,6 +90,7 @@ sm_math_init()
assert (sm_round_positive (0.2) == 0);
}

#if defined (__i386__) && defined (__GNUC__)
int
sm_fpu_okround()
{
Expand All @@ -98,6 +101,7 @@ sm_fpu_okround()
: "=m" (*&cv));
return !(cv & 0x0c00);
}
#endif

double
sm_lowpass1_factor (double mix_freq, double freq)
Expand Down
3 changes: 1 addition & 2 deletions lib/smnoisedecoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,7 @@ NoiseDecoder::apply_window (float *spectrum, float *fft_buffer)
else
#endif
{
__m128 out[(block_size + 2) / 4 + 1]; // SSE alignment (should be done by compiler)
float *spectrum = reinterpret_cast <float *> (&out[0]);
alignas (16) float spectrum[block_size + 2]; // SSE alignment
for (size_t i = 8; i < block_size + 2 + 8; i += 2)
{
float out_re = K0 * expand_in[i];
Expand Down

0 comments on commit 6fded91

Please sign in to comment.