mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] Superfluous shift in qsort()?
@ 2020-07-01 18:50 Markus Wichmann
  2020-07-01 20:44 ` Rich Felker
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Wichmann @ 2020-07-01 18:50 UTC (permalink / raw)
  To: musl

Hi all,

I noticed something while reading code today: Near the end of qsort(),
we have this gem:

shl(p, 2);
pshift -= 2;
p[0] ^= 7;
shr(p, 1);

Now, I don't know if I am missing something, but don't the shl and the
shr partially cancel out? Isn't this the same as

shl(p, 1);
p[0] ^= 3;

As it is, it isn't wrong, just weird.

Ciao,
Markus

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-07-06 22:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-01 18:50 [musl] Superfluous shift in qsort()? Markus Wichmann
2020-07-01 20:44 ` Rich Felker
2020-07-01 21:23   ` Valentin Ochs
2020-07-02 14:44     ` Markus Wichmann
2020-07-06 22:01       ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).