db-tu-dresden / TSL

Template SIMD Library (+Generator)
GNU General Public License v3.0
9 stars 8 forks source link

[NEON] Missing parentheses in `mask_ls_neon.hpp` #102

Closed lawben closed 3 months ago

lawben commented 3 months ago

I'm getting the following warning with NEON:

generate_tsl_neon-asimd/include/generated/definitions/mask_ls/mask_ls_neon.hpp:850:36: 
warning: & has lower precedence than ==; == will be evaluated first [-Wparentheses]
  850 |                   if ((imask >> i) & 0b1 == true) {
      |                                    ^~~~~~~~~~~~~

This looks like the generated code is "wrong". If == is evaluated first, the code checks if (mask >> i) & true, where true will just be 1. So this has the same effect in the end. You can probably just remove the == true because any value != 0 should evaluate to true anyway.

JPietrzykTUD commented 3 months ago

Fixed with #103