Skip to content

Commit

Permalink
wiseconnect: Drop use of pow()
Browse files Browse the repository at this point in the history
pow() is not defined when Zephyr is built with minimal libc. There is
only one occurence of the pow() function in Wiseconnect.

Since Wiseconnect only use pow() to compute power of 2, it can be
replaced by a bit shift.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
  • Loading branch information
jerome-pouiller authored and jhedberg committed Feb 7, 2025
1 parent 8086f30 commit 07dd0bf
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ rsi_error_t clk_set_i2s_pll_freq(const M4CLK_Type *pCLK, uint32_t i2sPllFreq, ui
FCW = (float)Fdco / (float)fref;
M = (uint16_t)FCW;
frac = (FCW - M);
FCW_F = (uint16_t)(frac * pow(2, 14));
FCW_F = (uint16_t)(frac * (1 << 14)); // (1 << 14) == pow(2, 14)
if (Fdco == I2S_DCO_FREQ1) {
FCW_F = (FCW_F + 1);
}
Expand Down

0 comments on commit 07dd0bf

Please # to comment.