]> git.saurik.com Git - wxWidgets.git/blame - utils/wxMMedia2/lib/converter.def
the in-place control uses the attr for colours/font info too
[wxWidgets.git] / utils / wxMMedia2 / lib / converter.def
CommitLineData
ef366f35
GL
1#define DEFINE_CONV(name, input_type, output_type, convert) \
2static void Convert_##name##(const char *buf_in, char *buf_out, wxUint32 len) \
526ddb13 3{\
ef366f35
GL
4 register input_type src; \
5 register const input_type *t_buf_in = (input_type *)buf_in; \
6 register output_type *t_buf_out = (output_type *)buf_out; \
526ddb13
GL
7\
8 while (len > 0) { \
ef366f35
GL
9 src = *t_buf_in++; \
10 *t_buf_out++ = convert; \
11 len--; \
12 } \
13}
14
15DEFINE_CONV(8_8_sign, wxUint8, wxUint8, (src ^ 0x80))
16
17DEFINE_CONV(8_16, wxUint8, wxUint16, (((wxUint16)src) << 8))
18DEFINE_CONV(8_16_swap, wxUint8, wxUint16, (src))
19DEFINE_CONV(8_16_sign, wxUint8, wxUint16, (((wxUint16)(src ^ 0x80)) << 8))
20DEFINE_CONV(8_16_sign_swap, wxUint8, wxUint16, (src ^ 0x80))
21
22DEFINE_CONV(16_8, wxUint16, wxUint8, (wxUint8)(src >> 8))
23DEFINE_CONV(16_8_sign, wxUint16, wxUint8, (wxUint8)((src >> 8) ^ 0x80))
24DEFINE_CONV(16_swap_8, wxUint16, wxUint8, (wxUint8)(src & 0xff))
25DEFINE_CONV(16_swap_8_sign, wxUint16, wxUint8, (wxUint8)((src & 0xff) ^ 0x80))
26
27DEFINE_CONV(16_sign, wxUint16, wxUint16, (src ^ 0x8000))
28DEFINE_CONV(16_swap, wxUint16, wxUint16, (((src & 0xff) << 8) | ((src >> 8) & 0xff)))
29DEFINE_CONV(16_swap_16_sign, wxUint16, wxUint16, ((((src & 0xff) << 8) | ((src >> 8) & 0xff)) ^ 0x8000))
30DEFINE_CONV(16_sign_16_swap, wxUint16, wxUint16, ((((src & 0xff) << 8) | ((src >> 8) & 0xff)) ^ 0x80))
31DEFINE_CONV(16_swap_16_sign_swap, wxUint16, wxUint16, (src ^ 0x80))