L
longhorn
Hello,
I'm looking for a macro that will return the longest range of ones
in an unsigned integer, along with starting and ending position.
For example I have an unsigned int data that looks like:
bit pos: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 .... 00
data 0 1 1 1 1 0 1 1 0 1 0 1 1 0 ... 0
In this case I would get the longest range = 4, start=27, end=30.
Does anyone know a simple way to do this?
Thanks,
Kevin
I'm looking for a macro that will return the longest range of ones
in an unsigned integer, along with starting and ending position.
For example I have an unsigned int data that looks like:
bit pos: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 .... 00
data 0 1 1 1 1 0 1 1 0 1 0 1 1 0 ... 0
In this case I would get the longest range = 4, start=27, end=30.
Does anyone know a simple way to do this?
Thanks,
Kevin