orlp / pdqsort

Pattern-defeating quicksort.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Check for i586 instead of i386

lpsantil opened this issue · comments

When defining rdtsc, you ought to be checking for atleast i586 instead of i386.

I believe I took the rdtsc code from this SO question, which uses __i386__ as well: http://stackoverflow.com/questions/9887839/clock-cycle-count-wth-gcc.

But I guess I can change it.

I hear ya. __i386__ is the "traditional" way of checking for an ia32 processor which is usually good enough for 80% of the time. The Wikipedia page also indicates some of the issues using the instruction on some of the early Pentium competitors as well. Nowadays, finding a CPU where the instruction wouldn't work would be difficult, 20 years on from the introduction of the instruction. However, if the IoT ever really picks up on the Intel Quarks & Curies, Via Edens & Nanos, and DM&P Vortex86s, you might care at that point. I can see your sort being useful in those environments.

@lpsantil Keep in mind that the sort works fine on any platform, only the benchmark code uses the rdtsc instruction.

Hasn't the issue been fixed by 23a2a55?

@Morwenn I believe so, forgot to close this.