On 08/16/2011 07:58 PM, Matt Turner wrote: > Signed-off-by: Matt Turner<[email protected]> > --- > include/misc.h | 30 ++++++++++++++++++++---------- > 1 files changed, 20 insertions(+), 10 deletions(-) > > diff --git a/include/misc.h b/include/misc.h > index d991c0a..6034c72 100644 > --- a/include/misc.h > +++ b/include/misc.h > @@ -259,20 +259,30 @@ version_compare(uint16_t a_major, uint16_t a_minor, > SwapLongs((CARD32 *)(stuff + 1), LengthRestL(stuff)) > > /* byte swap a 32-bit value */ > +static inline void swap_uint32(uint32_t *x) > +{ > + char n = ((char *)&x)[0]; > + ((char *) x)[0] = ((char *) x)[3]; > + ((char *) x)[3] = n; > + n = ((char *) x)[1]; > + ((char *) x)[1] = ((char *) x)[2]; > + ((char *) x)[2] = n; > +} > + > #define swapl(x) do { \ > - char n = ((char *) (x))[0];\ > - ((char *) (x))[0] = ((char *) (x))[3];\ > - ((char *) (x))[3] = n;\ > - n = ((char *) (x))[1];\ > - ((char *) (x))[1] = ((char *) (x))[2];\ > - ((char *) (x))[2] = n;\ > + swap_uint32((uint32_t *)(x)); \ > } while (0) > > -/* byte swap a short */ > +/* byte swap a 16-bit value */ > +static inline void swap_uint16(uint16_t *x) > +{ > + char n = ((char *) x)[0]; > + ((char *) x)[0] = ((char *) x)[1]; > + ((char *) x)[1] = n; > +} > + > #define swaps(x) do { \ > - char n = ((char *) (x))[0];\ > - ((char *) (x))[0] = ((char *) (x))[1];\ > - ((char *) (x))[1] = n;\ > + swap_uint16((uint16_t *)(x)); \ > } while (0) > > /* copy 32-bit value from src to dst byteswapping on the way */
This change (commit 893e86a49e3e381cff48a9e86dc2d9b3d5431d95) caused an XTS regression: 400|0 1 1 12:42:31|IC Start 200|0 1 12:42:31|TP Start 520|0 1 00012000 1 1|VSW5TESTSUITE PURPOSE 1 520|0 1 00012000 1 2|Assertion AllocColor-1.(A) 520|0 1 00012000 1 3|When a client sends a valid AllocColor protocol request to 520|0 1 00012000 1 4|the X server, then the X server sends back a reply to the 520|0 1 00012000 1 5|client with the minimum required length. 520|0 1 00012000 1 6|METH: Call library function testfunc() to do the following: 520|0 1 00012000 1 7|METH: Open a connection to the X server using native byte sex. 520|0 1 00012000 1 8|METH: Create colourmap with alloc set to AllocNone. 520|0 1 00012000 1 9|METH: Send a valid AllocColor protocol request to the X server. 520|0 1 00012000 1 10|METH: Verify that the X server sends back a reply. 520|0 1 00012000 1 11|METH: Open a connection to the X server using reversed byte sex. 520|0 1 00012000 1 12|METH: Create colourmap with alloc set to AllocNone. 520|0 1 00012000 1 13|METH: Send a valid AllocColor protocol request to the X server. 520|0 1 00012000 1 14|METH: Verify that the X server sends back a reply. 520|0 1 00012004 1 1|REPORT: Expect: wanted NOTHING, got ERROR - BadIDChoice 520|0 1 00012004 1 2|REPORT: Expect: wanted NOTHING, got ERROR - BadIDChoice 520|0 1 00012004 1 3|REPORT: Expect: wanted REPLY - X_AllocColor , got ERROR - BadColor 520|0 1 00012004 1 4|REPORT: client 0 failed to receive AllocColor reply 520|0 1 00012004 1 5|REPORT: Test AllocColor unresolved with 2 reasons. 220|0 1 2 12:42:31|UNRESOLVED 410|0 1 1 12:42:31|IC End _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
