Linux -Blue forest free software | Return to home page | Site Map | Search WWW | Contact Us |
Your current position : Homepage > Free Software > Technological exchanges >Application Programming


    

Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006


"<c Language adapter and Implementation", "code of a doubt

In Chapter 13 "vectors" section of the code are :
# Nbytes (practically) ((((practically) + 8 - 1) & (~ (8 - 1))) /8)

According to the book means that the Acer used to calculate [len/8], the question is :

1. I have seen this code to write and direct len/8 find no difference between Asia because :
(Practically + 8 - 1) & (~ (8 - 1)), is len+7 front, behind and on 7 premium is not that of seven away?

280-1 = 7, then why should be rewritten 8-1?

3. I carefully thought for a moment, think that this issue should be the exception and integer calculation, in the end what?

"<c Language adapter and Implementation", "code of a doubt

Of course there is a distinction. This procedure, if len<8, is the one and len/8 integer, if the len<8 is 0.

"<c Language adapter and Implementation", "code of a doubt

"<c Language adapter and Implementation", "code of a doubt

In fact, nbytes (n) = n / 8 +1
And
If len<8, are given 1;
No contradiction!

I saw the wording to read, but I have no problem 8-1 and 7 clear; Repeat tomorrow ask the Supreme find!

"<c Language adapter and Implementation", "code of a doubt

Give you another example :

N = 9;
N/8==1;
(N+7) /8 ==2;

This is to take the whole, and not lose spaces

(N+7) &&! (8-1) and went to the same role

"<c Language adapter and Implementation", "code of a doubt

Right there!

"<c Language adapter and Implementation", "code of a doubt

(Len+8-1) & (~ (8-1)) = (len+7) /8, meaning two months is practically required 229 spaces occupied by the byte count.
After a written translation of the former than the latter wording of computational efficiency.
Written (8-1), which was to improve the readability and easy replacement. For example, eight replaced 16, it becomes practically two months short of the 229 spaces occupied by the few.

"<c Language adapter and Implementation", "code of a doubt

Agree bierdaci

"<c Language adapter and Implementation", "code of a doubt

-->

So that it makes sense



 Privacy Policy  Copyright © 1999-2000 LSLNET.COM. All rights reserved. Blue Forest website owners. E-mail : Webmaster@lslnet.com