Algorithm newsgroup?

P

Paminu

Where do I find an algorithm newsgroup?

I am interested in getting some help with the "even parity check" algorithm.
I used google to find this back in 1999 from this newsgroup:

unsigned parity(unsigned arg)
{
unsigned a = arg;

a ^= a >> 16;
a ^= a >> 8;
a ^= a >> 4;
a ^= a >> 2;
a ^= a >> 1;

return a & 1;
}

Who have invented this algorithm?

Is it possible to find an explanation somewhere because I see that it works
but would never myself have come up with it and would very much like to
know the theory behind it.
 
A

Alexei A. Frounze

Paminu said:
Where do I find an algorithm newsgroup?

I can only suggest a Russian one, fido7.ru.algorithms which would work for
you only through a FIDO gateway and anyway most people there are Russian
speaking, so, I'm not sure you'll find it suitable for you... :(
I am interested in getting some help with the "even parity check" algorithm.
I used google to find this back in 1999 from this newsgroup:

unsigned parity(unsigned arg)
{
unsigned a = arg;

a ^= a >> 16;
a ^= a >> 8;
a ^= a >> 4;
a ^= a >> 2;
a ^= a >> 1;

return a & 1;
}

Who have invented this algorithm?

I have. Some Mr. John Brown has. Many people have invented that on their own
independently.
Is it possible to find an explanation somewhere because I see that it works
but would never myself have come up with it and would very much like to
know the theory behind it.

The explanation is simple: you XOR all bits of the number to get a single
bit in the end. The above does it very well, and w/o an unnecessary loop, I
must say.
But this is all Off Topic in this group as you may know... So, I'm shutting
up right here (had to do that in the beginning though).

Alex
 
P

Paminu

Alexei said:
I can only suggest a Russian one, fido7.ru.algorithms which would work for
you only through a FIDO gateway and anyway most people there are Russian
speaking, so, I'm not sure you'll find it suitable for you... :(


I have. Some Mr. John Brown has. Many people have invented that on their
own independently.


The explanation is simple: you XOR all bits of the number to get a single
bit in the end. The above does it very well, and w/o an unnecessary loop,
I must say.
But this is all Off Topic in this group as you may know... So, I'm
shutting up right here (had to do that in the beginning though).

Alex


hmm but since there is only russian newsgroups covering algorithms would
this group not be the most obvious group to discuss these kind of issues?

If not is there any other alternatives?
 
S

Skarmander

pete said:
Paminu wrote:




That's undefined if UCHAR_MAX equals 0xffffu.
UINT_MAX, of course.

And although you're right, we presumably aren't supposed to care.
Otherwise a loop *would* be more appropriate, to accommodate unsigned
ints of arbitrary sizes.

S.
 
A

Alexei A. Frounze

Paminu said:
hmm but since there is only russian newsgroups covering algorithms would
this group not be the most obvious group to discuss these kind of issues?

If not is there any other alternatives?

I simply don't know others. I prefer first to get my own solution, then look
for any hint elsewhere if I don't like mine (e.g. too complicated, too slow)
or if it's just incorrect/incomplete (e.g. doesn't cover the cases which I
don't know at all or don't understand clearly). As for understanding why
something works the way it does, if you have the code/formula for it, you
generally can understand that, not always quickly, however, especially if
either the formal language or the problem at hand (or both) isn't familiar
to you. It all depends on the experience, level of ignorance, logical
reasoning and researching skills, laziness and attitude, or, in other words,
on your past, present and where you want to get with all that in the future.
:)

Alex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,190
Latest member
Martindap

Latest Threads

Top