core: change bitarithm implementation

Cachegrind for `test_ipc_pingpong` with `-Os` added for native:
```
     Ir I1mr ILmr      Dr D1mr DLmr      Dw  D1mw  DLmw  file:function
--------------------------------------------------------------------------------
Before:
433,465    0    0  18,015    0    0   6,005     0     0  …/bitarithm.c:number_of_lowest_bit
After:
114,097    0    0  24,020    1    0   6,005     0     0  …/bitarithm.c:number_of_lowest_bit
```

(Closes #974)