I need to write a function to check that some value is consecutive, for example 0b0011100, 0b001111111 or 0b100000000 are OK (return not 0) but 0b00110010 and 0b001010 are not (all the ones should be sequential).
But here is the catch I need to do it without any loop.
I'm using some crazy API which not allowed to use loop, I only have the following arithmetic function:
+, -, *, |, ||, &, &&, ~, !, TZC, POPCNT, <<, >>
Which are:
plus, minus, mult, bitwise or, logical or, bitwise and, logical and, bitwise not, logical not, trailing zero counter (count the zeros from the LSB to first 1), pop-counter (count the number of ones), shift-left and shift-right.
All values are 64 bit length.