Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > what the meaning of this?

Reply
Thread Tools

what the meaning of this?

 
 
newbie
Guest
Posts: n/a
 
      03-03-2006
anyone know is it this source code value:-
T = ((Y >> 4) ^ X) & 0x0F0F0F0F; X ^= T; Y ^= (T << 4);

T = ((Y ) ^ X) & 0x10101010; X ^= T; Y ^= (T );

X = (LHs[ (X ) & 0xF] << 3) | (LHs[ (X >> & 0xF ] << 2)
| (LHs[ (X >> 16) & 0xF] << 1) | (LHs[ (X >> 24) & 0xF ] )
| (LHs[ (X >> 5) & 0xF] << 7) | (LHs[ (X >> 13) & 0xF ] << 6)
| (LHs[ (X >> 21) & 0xF] << 5) | (LHs[ (X >> 29) & 0xF ] << 4);

Y = (RHs[ (Y >> 1) & 0xF] << 3) | (RHs[ (Y >> 9) & 0xF ] << 2)
| (RHs[ (Y >> 17) & 0xF] << 1) | (RHs[ (Y >> 25) & 0xF ] )
| (RHs[ (Y >> 4) & 0xF] << 7) | (RHs[ (Y >> 12) & 0xF ] << 6)
| (RHs[ (Y >> 20) & 0xF] << 5) | (RHs[ (Y >> 2 & 0xF ] << 4);

X &= 0x0FFFFFFF;
Y &= 0x0FFFFFFF;

same as the PC-1 table value?

PC-1
57 49 41 33 25 17 9
1 58 50 42 34 26 18
10 2 59 51 43 35 27
19 11 3 60 52 44 36

63 55 47 39 31 23 15
7 62 54 46 38 30 22
14 6 61 53 45 37 29
21 13 5 28 20 12 4

and how to compare both?

 
Reply With Quote
 
 
 
 
Walter Roberson
Guest
Posts: n/a
 
      03-03-2006
In article <(E-Mail Removed). com>,
newbie <(E-Mail Removed)> wrote:
>anyone know is it this source code value:-
> T = ((Y >> 4) ^ X) & 0x0F0F0F0F; X ^= T; Y ^= (T << 4);
>
> T = ((Y ) ^ X) & 0x10101010; X ^= T; Y ^= (T );
>
> X = (LHs[ (X ) & 0xF] << 3) | (LHs[ (X >> & 0xF ] << 2)
> | (LHs[ (X >> 16) & 0xF] << 1) | (LHs[ (X >> 24) & 0xF ] )


You have not shown us the definition of LHs or RHs, so we cannot
tell you what this expression produces.

>same as the PC-1 table value?


> PC-1
> 57 49 41 33 25 17 9
> 1 58 50 42 34 26 18
> 10 2 59 51 43 35 27
> 19 11 3 60 52 44 36
>
> 63 55 47 39 31 23 15
> 7 62 54 46 38 30 22
> 14 6 61 53 45 37 29
> 21 13 5 28 20 12 4


>and how to compare both?



The code involves two input variables, X and Y, of at least 29
bits, and calculates 3 values, T, X, and Y. T could plausibly be
a temporary value, but the structure of the code shows that X and Y
are both outputs.

You ask that this output be compared to a single table, apparently
of size 8 x 7, or perhaps 2 x 4 x 7, and whose values appear to be
6 bits wide.

Even if we interpret the empty line as indicating two output tables,
one for X and the other for Y, we have a dimensionality clash:
the output of an operation upon a 29+ bit value cannot be less than
2^29th values [even if all the rest of them turn out to be 0]
and a single variable of output cannot be compared to a 4 x 7 table
of outputs without a mapping function... and no mapping function
has been defined.

Hence, no matter what the arithmetic produces, we can deduce
that it does -not- produce the table we are asked to compare against.
[Thus we do not need to analyze the bit-manipulation logic to produce
the definite answer "NO".]
--
"law -- it's a commodity"
-- Andrew Ryan (The Globe and Mail, 2005/11/26)
 
Reply With Quote
 
 
 
 
newbie
Guest
Posts: n/a
 
      03-05-2006
the RH and LH as below:-

static uint32 LHs[16] =
{
0x00000000, 0x00000001, 0x00000100, 0x00000101,
0x00010000, 0x00010001, 0x00010100, 0x00010101,
0x01000000, 0x01000001, 0x01000100, 0x01000101,
0x01010000, 0x01010001, 0x01010100, 0x01010101
};

static uint32 RHs[16] =
{
0x00000000, 0x01000000, 0x00010000, 0x01010000,
0x00000100, 0x01000100, 0x00010100, 0x01010100,
0x00000001, 0x01000001, 0x00010001, 0x01010001,
0x00000101, 0x01000101, 0x00010101, 0x01010101,
};

so what the expression produce?

 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      03-05-2006
newbie wrote:
>
> the RH and LH as below:-
>
> static uint32 LHs[16] =
> {
> 0x00000000, 0x00000001, 0x00000100, 0x00000101,
> 0x00010000, 0x00010001, 0x00010100, 0x00010101,
> 0x01000000, 0x01000001, 0x01000100, 0x01000101,
> 0x01010000, 0x01010001, 0x01010100, 0x01010101
> };
>
> static uint32 RHs[16] =
> {
> 0x00000000, 0x01000000, 0x00010000, 0x01010000,
> 0x00000100, 0x01000100, 0x00010100, 0x01010100,
> 0x00000001, 0x01000001, 0x00010001, 0x01010001,
> 0x00000101, 0x01000101, 0x00010101, 0x01010101,
> };
>
> so what the expression produce?


Those are not expressions, they are initialization statements
attached to a declaration. Who knows what they are intended to
represent.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>


 
Reply With Quote
 
Walter Roberson
Guest
Posts: n/a
 
      03-05-2006
In article <(E-Mail Removed) .com>,
newbie <(E-Mail Removed)> wrote:

>the RH and LH as below:-


Q: How do you tell that someone is using google groups as their
newsreader?

A: Look for the complete lack of quoting and attribution.


>static uint32 LHs[16] =
>{
> 0x00000000, 0x00000001, 0x00000100, 0x00000101,


>static uint32 RHs[16] =
>{
> 0x00000000, 0x01000000, 0x00010000, 0x01010000,


>so what the expression produce?


Which expression? As I pointed out before, the code obviously
calculates *two* values, X and Y, not just *one* value.

Your original question was, if I recall correctly, whether the
code produced the same answer as the table of values you showed.
[If I don't recall correctly, it's because you failed to quote
appropriate context.]

Examining the code and examining the table of values, without
knowing what a "PC-1" is, and without figuring out exactly what the
code calculates, we can determine that the code does not produce
the given table of values -- not unless there are some unstated
restrictions on the input values.

To prove that the table values are not what the code produces, start
with X and Y both 0. T is calculated in terms of shifts and XOR.
Unsigned shifts never introduce binary 1's where there were none
to start with, so the shifts are going to leave the values as 0.
Similarily, XOR of 0 and 0 is 0, so the XOR is not going to
introduce any new binary 1's. We can thus deduce that at the
end of the introductory sequence, X, Y, and T will all be 0 when
X and Y started at 0.

Now look at the pair of long expressions. There are lookups and
shifts and binary ORs. Again shifts and OR do not introduce new 1s
out of 0's. But it is the looked-up values that are manipulated,
so examine those. In each case, the array index used is a shift
and AND of X or Y, and we know X and Y are 0 here, so in each
case the array index used is going to be 0. And when we look
at LHS[0] and RHS[0], we see 0's in both locations. From this
we can deduce that when X and Y start out as 0, the final X and Y
values are both going to come out as 0.

If we know look at the PC-1 table of values given, then no matter
how we mentally account for the mismatch in dimensions, we can see
that none of the PC-1 values are ever 0. There is thus an output
pair from the code that is not to be found in the PC-1 values,
and hence the PC-1 values are not those produced by the code --
at least to the limits of the documentation we are given about the
input ranges.
--
Programming is what happens while you're busy making other plans.
 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      03-05-2006
Walter Roberson wrote:
>

.... snip ...
>
> Q: How do you tell that someone is using google groups as their
> newsreader?
>
> A: Look for the complete lack of quoting and attribution.


Most of the time just read the Organization: header in the
article. If this says google, and the article is properly quoted,
snipped, and not top-posted, you are fairly safe in assuming the
writer to be an intelligent lifeform.

At other times the user-agent: or X-newsreader: headers may be
present and informative. Seeing these things involves viewing full
headers or message source.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>


 
Reply With Quote
 
Default User
Guest
Posts: n/a
 
      03-06-2006
CBFalconer wrote:

> Walter Roberson wrote:
> >

> ... snip ...
> >
> > Q: How do you tell that someone is using google groups as their
> > newsreader?
> >
> > A: Look for the complete lack of quoting and attribution.

>
> Most of the time just read the Organization: header in the
> article. If this says google, and the article is properly quoted,
> snipped, and not top-posted, you are fairly safe in assuming the
> writer to be an intelligent lifeform.
>
> At other times the user-agent: or X-newsreader: headers may be
> present and informative. Seeing these things involves viewing full
> headers or message source.


Or have a newsreader that allows you to customize the headers that are
displayed. I added User-Agent to the usual From, Subject, and
Newsgroups lines. That way, when I see G2/0.2 I know it's Google and
can tailor my response as needed.


Brian

 
Reply With Quote
 
Walter Roberson
Guest
Posts: n/a
 
      03-06-2006
In article <(E-Mail Removed)>,
CBFalconer <(E-Mail Removed)> wrote:
>Walter Roberson wrote:
>> Q: How do you tell that someone is using google groups as their
>> newsreader?


>> A: Look for the complete lack of quoting and attribution.


>At other times the user-agent: or X-newsreader: headers may be
>present and informative. Seeing these things involves viewing full
>headers or message source.


The header fields are densely packed; it's a lot faster to notice the
lack of quoting and attribution.

Admittedly, the correlation is not 100%, but it has become so common
these days that we are going to have to come up with a new
expression to describe it, as it seems to me that we are
now beyond the behaviour set implied by "The Endless September".
How does "The Endless Google" ring?
--
I was very young in those days, but I was also rather dim.
-- Christopher Priest
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Understanding search queries, semantics, and "Meaning" ...aren't weall looking for meaning? 5lvqbwl02@sneakemail.com Python 4 01-14-2009 02:28 PM
use work.my_package.all-->what exactly meaning of this Parthav VHDL 4 01-13-2006 07:50 PM
WHAT IS THE MEANING *FESWANY MCSE 3 01-28-2005 02:55 PM
Meaning of word "develop" in the exam (70-300) TomTom MCSD 10 08-13-2004 04:39 PM
Meaning of output value? Sander Odekerken VHDL 2 05-18-2004 05:41 PM



Advertisments