3 static uint16_t swap16(uint16_t x)
5 return ((x & 0xff) << 8) | ((x & 0xff00) >> 8);
8 static uint32_t swap32(uint32_t x)
10 return ((x & 0xff) << 24) | ((x & 0xff00) << 8) | ((x & 0xff0000) >> 8) |
11 ((x & 0xff000000) >> 24);
14 #define SWAP16(x) ((x) = swap16(x))
15 #define SWAP32(x) ((x) = swap32(x))
17 void swap_xconn_accept(struct xconn_accept_header *hdr)
19 SWAP16(hdr->proto_major);
20 SWAP16(hdr->proto_minor);
21 SWAP16(hdr->add_length);
23 SWAP32(hdr->resid_base);
24 SWAP32(hdr->resid_mask);
25 SWAP32(hdr->motionbuf_size);
26 SWAP16(hdr->vendor_length);
27 SWAP16(hdr->max_req_length);
28 /* TODO swap pixel formats and screens */
31 void swap_xreq_header(struct xrequest_header *hdr)