Can you explain the code below for me ? the three functions return values to the main program to :

Count the longest string of 1’s

,Count the longest string of 0’s.

,Count the longest alternating 1’s and 0’s.

Code:

int ONES(int data)
{
int i, shift;
for (i = 0; data != 0; i++) {
shift = (data >> 1) & 0x7FFFFFFF; // shift right logical
data = data & shift;
}
return (i);
}
int ZEROS(int data)
{
return (ONES(data ^ 0xFFFFFFFF));
}
int ALTERNATE(int data)
{
int ret_val1, ret_val0;
data = data ^ 0x55555555;
ret_val1 = ONES(data);
ret_val0 = ZEROS(data);
return (ret_val1 > ret_val0 ? ret_val1 : ret_val0);
}