PPI: Fix UBSAN warning

The result of shifting an int 31 bits left is in principle
undefined. So let's cast 1 to a uint32_t before shifting.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2024-01-24 15:08:38 +01:00
parent d17c9d749c
commit 24f5d3d11e
1 changed files with 1 additions and 1 deletions

View File

@ -732,7 +732,7 @@ void nrf_ppi_event(ppi_event_types_t event){
for ( int ch_nbr = __builtin_ffs(ch_mask) - 1;
( ch_mask != 0 ) && ( ch_nbr < NUMBER_PPI_CHANNELS ) ;
ch_nbr++ ) {
if ( ch_mask & ( 1 << ch_nbr ) ){
if ( ch_mask & ( (uint32_t) 1 << ch_nbr ) ){
ch_mask &= ~( (uint64_t) 1 << ch_nbr );
if ( ppi_ch_tasks[ch_nbr].tep_f != NULL ){
nrf_ppi_enqueue_task(ppi_ch_tasks[ch_nbr].tep_f);