Another programming puzzle
-
What is this bit of code dong.
long stuff(long n1,long n)
{
long a;
long c = 0;
long d = (2 * (n1/2));
for (a = 1; d - a > 0;a *= 2)
c++;
a = _lrotl(n,c);
if(n1 - d)
a += n;
return a;
}No fare compiling it. ;) This Sig For Rent
Corky -
Magnus H wrote: Is it the Linux kernel?? You one of these, "I hate Linux" people?
:~ (-_-) :~
-
Magnus H wrote: Is it the Linux kernel?? You one of these, "I hate Linux" people?
:~ (-_-) :~
-
No, dont have any opinion at all about since i never used it. :wtf: (just because it looks so cool ) /Magnus
Magnus H wrote: :wtf: (just because it looks so cool ) lol... :rolleyes: is cool too
:~ (-_-) :~
-
What is this bit of code dong.
long stuff(long n1,long n)
{
long a;
long c = 0;
long d = (2 * (n1/2));
for (a = 1; d - a > 0;a *= 2)
c++;
a = _lrotl(n,c);
if(n1 - d)
a += n;
return a;
}No fare compiling it. ;) This Sig For Rent
CorkyI think this is changing from little endian to big endian. Am I right??? Brigg Thorp Software Engineer Timex Corporation
-
What is this bit of code dong.
long stuff(long n1,long n)
{
long a;
long c = 0;
long d = (2 * (n1/2));
for (a = 1; d - a > 0;a *= 2)
c++;
a = _lrotl(n,c);
if(n1 - d)
a += n;
return a;
}No fare compiling it. ;) This Sig For Rent
CorkyI don't know how to express it in English. But I think what the program is trying to do is: to multiply n by a factor K, where K is 2^nll if nl is even Or a = n* (2^nll + 1) if nl is odd. nll is determined by nl. For example, if nl = 9, then nll = 3, in that 2^4 > 9 > 2^3. If nl = 16, then nll = 4, where 16 = 2^4. The for loop is to get the nll based on nl. Is my guess right? (what a hell is my English. :-()
-
What is this bit of code dong.
long stuff(long n1,long n)
{
long a;
long c = 0;
long d = (2 * (n1/2));
for (a = 1; d - a > 0;a *= 2)
c++;
a = _lrotl(n,c);
if(n1 - d)
a += n;
return a;
}No fare compiling it. ;) This Sig For Rent
Corky -
I think i should post some of my own code as a puzzle, then maybe i finally can find out what it actually does. :) /Magnus
Magnus H wrote: I think i should post some of my own code as a puzzle, then maybe i finally can find out what it actually does. LOL... yeah/ the code that I write when I'm tired normally doesn't make any sense the next day. I think your is a good idea.
:~ (-_-) :~
-
I don't know how to express it in English. But I think what the program is trying to do is: to multiply n by a factor K, where K is 2^nll if nl is even Or a = n* (2^nll + 1) if nl is odd. nll is determined by nl. For example, if nl = 9, then nll = 3, in that 2^4 > 9 > 2^3. If nl = 16, then nll = 4, where 16 = 2^4. The for loop is to get the nll based on nl. Is my guess right? (what a hell is my English. :-()