[Pixman] Use of bitwise operators on vectors with Boolean results

Michael Tautschnig mt at debian.org
Sun Jun 22 03:43:49 PDT 2014


Dear Pixman Developers,

While doing some experiments using a toolkit built around CBMC we noticed that
test/utils-prng.c has code like

  randdata.vb |= (t.vb >= const_C0);

(http://cgit.freedesktop.org/pixman/tree/test/utils-prng.c#n131)

with all operands being vectors. While our type checker struggled here, there
isn't necessarily anything wrong with this statement. Yet I was wondering
whether this was really doing what the developer intended to do: effectively
this will either leave randdata.vb unchanged (if the right-hand side is false)
or will set all (!) bits of randdata.vb as, at least on the platforms that I
tried, comparisons on vectors yield (unsigned)-1 as representation of "true."

Best,
Michael

PS.: I'm not subscribed, please keep me CC'ed.



More information about the Pixman mailing list