...also returns location 0 if no bits are set.
Oops, hadn't spotted that ...
Perhaps we need an AOI developed to do this ?
Logix500 processors (most of them) had an ENC instruction which would tell you the first bit set, but this was from lowest to highest bit.
So perhaps an AOI should have a parameter for which way to go, lowest to highest, or contra ....