[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

Re: Source code Questions




> in_uint8(s, len); //read length
>
> if (len & 0x80) {     // if len = 0x80?

This doesn't check to see if len is equal to 0x80; it checks to see if the
0x80 (1000 0000 in base 2) bit is set.  & is a bitwise AND in C.

> 	len &= ~0x80; // len=0?

Then this line ANDs the len with ~0x80 (0111 1111 in base 2), which simply
clears the same bit that was checked in the if statement. (~ is a bitwise
NOT, whereas ! is a logical NOT)

I think this may help you read the rest of it (because I don't know what
it does :-).  Counts as many times as len, doing what?

> 	*length = 0;
>
> 	while (len--) //?
> 		next_be(s, *length); //?
> } else

-Brian