clean up and comment the repeat macros

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@708 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Jay Sorg 2004-06-11 22:37:05 +00:00
parent 312035fd20
commit d33f94f744

45
xwin.c
View File

@ -230,8 +230,25 @@ translate_colour(uint32 colour)
return make_colour(pc); return make_colour(pc);
} }
/* indent is confused by UNROLL8 */
/* *INDENT-OFF* */
/* repeat and unroll, similar to bitmap.c */
/* potentialy any of the following translate */
/* functions can use repeat but just doing */
/* the most common ones */
#define UNROLL8(stm) { stm stm stm stm stm stm stm stm } #define UNROLL8(stm) { stm stm stm stm stm stm stm stm }
#define REPEAT(stm) \ /* 2 byte output repeat */
#define REPEAT2(stm) \
{ \
while (out <= end - 8 * 2) \
UNROLL8(stm) \
while (out < end) \
{ stm } \
}
/* 4 byte output repeat */
#define REPEAT4(stm) \
{ \ { \
while (out <= end - 8 * 4) \ while (out <= end - 8 * 4) \
UNROLL8(stm) \ UNROLL8(stm) \
@ -252,10 +269,14 @@ translate8to16(uint8 * data, uint8 * out, uint8 * end)
uint16 value; uint16 value;
if (g_arch_match) if (g_arch_match)
REPEAT(*((uint16 *) out) = g_colmap[*(data++)]; {
out += 2;) REPEAT2
else (
if (g_xserver_be) *((uint16 *) out) = g_colmap[*(data++)];
out += 2;
)
}
else if (g_xserver_be)
{ {
while (out < end) while (out < end)
{ {
@ -309,10 +330,14 @@ translate8to32(uint8 * data, uint8 * out, uint8 * end)
uint32 value; uint32 value;
if (g_arch_match) if (g_arch_match)
REPEAT(*((uint32 *) out) = g_colmap[*(data++)]; {
out += 4;) REPEAT4
else (
if (g_xserver_be) *((uint32 *) out) = g_colmap[*(data++)];
out += 4;
)
}
else if (g_xserver_be)
{ {
while (out < end) while (out < end)
{ {
@ -336,6 +361,8 @@ else
} }
} }
/* *INDENT-ON* */
static void static void
translate15to16(uint16 * data, uint8 * out, uint8 * end) translate15to16(uint16 * data, uint8 * out, uint8 * end)
{ {