I make the first one equivalent to :
Code C - [expand] |
1
2
3
4
| do {
e -= binom;
binom = choose (n,++c);
} while ((binom <= e); |
It is a combined assignment and comparision, and bad style in my view as it is unnecassarily difficult to read.
Code C - [expand] |
1
| if (e == 0 || (binom = choose(n - 1, c - 1)) > e) |
This is subtle due to "Short circuit evaluation", but does the following logic:
if (e == 0) the expression evaluates as true and the rest is not evaluated, else
assign binom = choose (n-1, c-1),
if the resulting binom value is > e evaluate as true else evaluate as false.
It could use a comment, simply so that it does not need careful checking on review.
Code C - [expand] |
1
| while (--n && c && ((b <<= 1) || 1)); |
This is another where short circuit evaluation is the key.
Note that ((b<<=1) || 1) will always evaluate as true, but has a side effect which is really the point of this part, namely left shifting b one bit.
Considering short circuit evaluation, this reads as :
if --n == 0 evaluate as false else if c != 0 left shift b one bit and evaluate as true, else evaluate as false.
Again horrible style because it is hard to read, it really needs a comment at least if not restructuring into something far easier to follow.
73 Dan.