Looks very similar to `number_of_lowest_bit()` from `core/bitarithm.c`. I think we should make the latter one a wrapper using this.