plugin_ops.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. /*
  2. * Plugin sample operators with fast switch
  3. * Copyright (c) 2000 by Jaroslav Kysela <perex@suse.cz>
  4. *
  5. *
  6. * This library is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU Library General Public License as
  8. * published by the Free Software Foundation; either version 2 of
  9. * the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Library General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Library General Public
  17. * License along with this library; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. *
  20. */
  21. #define as_u8(ptr) (*(u_int8_t*)(ptr))
  22. #define as_u16(ptr) (*(u_int16_t*)(ptr))
  23. #define as_u32(ptr) (*(u_int32_t*)(ptr))
  24. #define as_u64(ptr) (*(u_int64_t*)(ptr))
  25. #define as_s8(ptr) (*(int8_t*)(ptr))
  26. #define as_s16(ptr) (*(int16_t*)(ptr))
  27. #define as_s32(ptr) (*(int32_t*)(ptr))
  28. #define as_s64(ptr) (*(int64_t*)(ptr))
  29. #ifdef COPY_LABELS
  30. static void *copy_labels[4] = {
  31. &&copy_8,
  32. &&copy_16,
  33. &&copy_32,
  34. &&copy_64
  35. };
  36. #endif
  37. #ifdef COPY_END
  38. while(0) {
  39. copy_8: as_s8(dst) = as_s8(src); goto COPY_END;
  40. copy_16: as_s16(dst) = as_s16(src); goto COPY_END;
  41. copy_32: as_s32(dst) = as_s32(src); goto COPY_END;
  42. copy_64: as_s64(dst) = as_s64(src); goto COPY_END;
  43. }
  44. #endif
  45. #ifdef CONV_LABELS
  46. /* src_wid src_endswap sign_toggle dst_wid dst_endswap */
  47. static void *conv_labels[4 * 2 * 2 * 4 * 2] = {
  48. &&conv_xxx1_xxx1, /* 8h -> 8h */
  49. &&conv_xxx1_xxx1, /* 8h -> 8s */
  50. &&conv_xxx1_xx10, /* 8h -> 16h */
  51. &&conv_xxx1_xx01, /* 8h -> 16s */
  52. &&conv_xxx1_x100, /* 8h -> 24h */
  53. &&conv_xxx1_001x, /* 8h -> 24s */
  54. &&conv_xxx1_1000, /* 8h -> 32h */
  55. &&conv_xxx1_0001, /* 8h -> 32s */
  56. &&conv_xxx1_xxx9, /* 8h ^> 8h */
  57. &&conv_xxx1_xxx9, /* 8h ^> 8s */
  58. &&conv_xxx1_xx90, /* 8h ^> 16h */
  59. &&conv_xxx1_xx09, /* 8h ^> 16s */
  60. &&conv_xxx1_x900, /* 8h ^> 24h */
  61. &&conv_xxx1_009x, /* 8h ^> 24s */
  62. &&conv_xxx1_9000, /* 8h ^> 32h */
  63. &&conv_xxx1_0009, /* 8h ^> 32s */
  64. &&conv_xxx1_xxx1, /* 8s -> 8h */
  65. &&conv_xxx1_xxx1, /* 8s -> 8s */
  66. &&conv_xxx1_xx10, /* 8s -> 16h */
  67. &&conv_xxx1_xx01, /* 8s -> 16s */
  68. &&conv_xxx1_x100, /* 8s -> 24h */
  69. &&conv_xxx1_001x, /* 8s -> 24s */
  70. &&conv_xxx1_1000, /* 8s -> 32h */
  71. &&conv_xxx1_0001, /* 8s -> 32s */
  72. &&conv_xxx1_xxx9, /* 8s ^> 8h */
  73. &&conv_xxx1_xxx9, /* 8s ^> 8s */
  74. &&conv_xxx1_xx90, /* 8s ^> 16h */
  75. &&conv_xxx1_xx09, /* 8s ^> 16s */
  76. &&conv_xxx1_x900, /* 8s ^> 24h */
  77. &&conv_xxx1_009x, /* 8s ^> 24s */
  78. &&conv_xxx1_9000, /* 8s ^> 32h */
  79. &&conv_xxx1_0009, /* 8s ^> 32s */
  80. &&conv_xx12_xxx1, /* 16h -> 8h */
  81. &&conv_xx12_xxx1, /* 16h -> 8s */
  82. &&conv_xx12_xx12, /* 16h -> 16h */
  83. &&conv_xx12_xx21, /* 16h -> 16s */
  84. &&conv_xx12_x120, /* 16h -> 24h */
  85. &&conv_xx12_021x, /* 16h -> 24s */
  86. &&conv_xx12_1200, /* 16h -> 32h */
  87. &&conv_xx12_0021, /* 16h -> 32s */
  88. &&conv_xx12_xxx9, /* 16h ^> 8h */
  89. &&conv_xx12_xxx9, /* 16h ^> 8s */
  90. &&conv_xx12_xx92, /* 16h ^> 16h */
  91. &&conv_xx12_xx29, /* 16h ^> 16s */
  92. &&conv_xx12_x920, /* 16h ^> 24h */
  93. &&conv_xx12_029x, /* 16h ^> 24s */
  94. &&conv_xx12_9200, /* 16h ^> 32h */
  95. &&conv_xx12_0029, /* 16h ^> 32s */
  96. &&conv_xx12_xxx2, /* 16s -> 8h */
  97. &&conv_xx12_xxx2, /* 16s -> 8s */
  98. &&conv_xx12_xx21, /* 16s -> 16h */
  99. &&conv_xx12_xx12, /* 16s -> 16s */
  100. &&conv_xx12_x210, /* 16s -> 24h */
  101. &&conv_xx12_012x, /* 16s -> 24s */
  102. &&conv_xx12_2100, /* 16s -> 32h */
  103. &&conv_xx12_0012, /* 16s -> 32s */
  104. &&conv_xx12_xxxA, /* 16s ^> 8h */
  105. &&conv_xx12_xxxA, /* 16s ^> 8s */
  106. &&conv_xx12_xxA1, /* 16s ^> 16h */
  107. &&conv_xx12_xx1A, /* 16s ^> 16s */
  108. &&conv_xx12_xA10, /* 16s ^> 24h */
  109. &&conv_xx12_01Ax, /* 16s ^> 24s */
  110. &&conv_xx12_A100, /* 16s ^> 32h */
  111. &&conv_xx12_001A, /* 16s ^> 32s */
  112. &&conv_x123_xxx1, /* 24h -> 8h */
  113. &&conv_x123_xxx1, /* 24h -> 8s */
  114. &&conv_x123_xx12, /* 24h -> 16h */
  115. &&conv_x123_xx21, /* 24h -> 16s */
  116. &&conv_x123_x123, /* 24h -> 24h */
  117. &&conv_x123_321x, /* 24h -> 24s */
  118. &&conv_x123_1230, /* 24h -> 32h */
  119. &&conv_x123_0321, /* 24h -> 32s */
  120. &&conv_x123_xxx9, /* 24h ^> 8h */
  121. &&conv_x123_xxx9, /* 24h ^> 8s */
  122. &&conv_x123_xx92, /* 24h ^> 16h */
  123. &&conv_x123_xx29, /* 24h ^> 16s */
  124. &&conv_x123_x923, /* 24h ^> 24h */
  125. &&conv_x123_329x, /* 24h ^> 24s */
  126. &&conv_x123_9230, /* 24h ^> 32h */
  127. &&conv_x123_0329, /* 24h ^> 32s */
  128. &&conv_123x_xxx3, /* 24s -> 8h */
  129. &&conv_123x_xxx3, /* 24s -> 8s */
  130. &&conv_123x_xx32, /* 24s -> 16h */
  131. &&conv_123x_xx23, /* 24s -> 16s */
  132. &&conv_123x_x321, /* 24s -> 24h */
  133. &&conv_123x_123x, /* 24s -> 24s */
  134. &&conv_123x_3210, /* 24s -> 32h */
  135. &&conv_123x_0123, /* 24s -> 32s */
  136. &&conv_123x_xxxB, /* 24s ^> 8h */
  137. &&conv_123x_xxxB, /* 24s ^> 8s */
  138. &&conv_123x_xxB2, /* 24s ^> 16h */
  139. &&conv_123x_xx2B, /* 24s ^> 16s */
  140. &&conv_123x_xB21, /* 24s ^> 24h */
  141. &&conv_123x_12Bx, /* 24s ^> 24s */
  142. &&conv_123x_B210, /* 24s ^> 32h */
  143. &&conv_123x_012B, /* 24s ^> 32s */
  144. &&conv_1234_xxx1, /* 32h -> 8h */
  145. &&conv_1234_xxx1, /* 32h -> 8s */
  146. &&conv_1234_xx12, /* 32h -> 16h */
  147. &&conv_1234_xx21, /* 32h -> 16s */
  148. &&conv_1234_x123, /* 32h -> 24h */
  149. &&conv_1234_321x, /* 32h -> 24s */
  150. &&conv_1234_1234, /* 32h -> 32h */
  151. &&conv_1234_4321, /* 32h -> 32s */
  152. &&conv_1234_xxx9, /* 32h ^> 8h */
  153. &&conv_1234_xxx9, /* 32h ^> 8s */
  154. &&conv_1234_xx92, /* 32h ^> 16h */
  155. &&conv_1234_xx29, /* 32h ^> 16s */
  156. &&conv_1234_x923, /* 32h ^> 24h */
  157. &&conv_1234_329x, /* 32h ^> 24s */
  158. &&conv_1234_9234, /* 32h ^> 32h */
  159. &&conv_1234_4329, /* 32h ^> 32s */
  160. &&conv_1234_xxx4, /* 32s -> 8h */
  161. &&conv_1234_xxx4, /* 32s -> 8s */
  162. &&conv_1234_xx43, /* 32s -> 16h */
  163. &&conv_1234_xx34, /* 32s -> 16s */
  164. &&conv_1234_x432, /* 32s -> 24h */
  165. &&conv_1234_234x, /* 32s -> 24s */
  166. &&conv_1234_4321, /* 32s -> 32h */
  167. &&conv_1234_1234, /* 32s -> 32s */
  168. &&conv_1234_xxxC, /* 32s ^> 8h */
  169. &&conv_1234_xxxC, /* 32s ^> 8s */
  170. &&conv_1234_xxC3, /* 32s ^> 16h */
  171. &&conv_1234_xx3C, /* 32s ^> 16s */
  172. &&conv_1234_xC32, /* 32s ^> 24h */
  173. &&conv_1234_23Cx, /* 32s ^> 24s */
  174. &&conv_1234_C321, /* 32s ^> 32h */
  175. &&conv_1234_123C, /* 32s ^> 32s */
  176. };
  177. #endif
  178. #ifdef CONV_END
  179. while(0) {
  180. conv_xxx1_xxx1: as_u8(dst) = as_u8(src); goto CONV_END;
  181. conv_xxx1_xx10: as_u16(dst) = (u_int16_t)as_u8(src) << 8; goto CONV_END;
  182. conv_xxx1_xx01: as_u16(dst) = (u_int16_t)as_u8(src); goto CONV_END;
  183. conv_xxx1_x100: as_u32(dst) = (u_int32_t)as_u8(src) << 16; goto CONV_END;
  184. conv_xxx1_001x: as_u32(dst) = (u_int32_t)as_u8(src) << 8; goto CONV_END;
  185. conv_xxx1_1000: as_u32(dst) = (u_int32_t)as_u8(src) << 24; goto CONV_END;
  186. conv_xxx1_0001: as_u32(dst) = (u_int32_t)as_u8(src); goto CONV_END;
  187. conv_xxx1_xxx9: as_u8(dst) = as_u8(src) ^ 0x80; goto CONV_END;
  188. conv_xxx1_xx90: as_u16(dst) = (u_int16_t)(as_u8(src) ^ 0x80) << 8; goto CONV_END;
  189. conv_xxx1_xx09: as_u16(dst) = (u_int16_t)(as_u8(src) ^ 0x80); goto CONV_END;
  190. conv_xxx1_x900: as_u32(dst) = (u_int32_t)(as_u8(src) ^ 0x80) << 16; goto CONV_END;
  191. conv_xxx1_009x: as_u32(dst) = (u_int32_t)(as_u8(src) ^ 0x80) << 8; goto CONV_END;
  192. conv_xxx1_9000: as_u32(dst) = (u_int32_t)(as_u8(src) ^ 0x80) << 24; goto CONV_END;
  193. conv_xxx1_0009: as_u32(dst) = (u_int32_t)(as_u8(src) ^ 0x80); goto CONV_END;
  194. conv_xx12_xxx1: as_u8(dst) = as_u16(src) >> 8; goto CONV_END;
  195. conv_xx12_xx12: as_u16(dst) = as_u16(src); goto CONV_END;
  196. conv_xx12_xx21: as_u16(dst) = swab16(as_u16(src)); goto CONV_END;
  197. conv_xx12_x120: as_u32(dst) = (u_int32_t)as_u16(src) << 8; goto CONV_END;
  198. conv_xx12_021x: as_u32(dst) = (u_int32_t)swab16(as_u16(src)) << 8; goto CONV_END;
  199. conv_xx12_1200: as_u32(dst) = (u_int32_t)as_u16(src) << 16; goto CONV_END;
  200. conv_xx12_0021: as_u32(dst) = (u_int32_t)swab16(as_u16(src)); goto CONV_END;
  201. conv_xx12_xxx9: as_u8(dst) = (as_u16(src) >> 8) ^ 0x80; goto CONV_END;
  202. conv_xx12_xx92: as_u16(dst) = as_u16(src) ^ 0x8000; goto CONV_END;
  203. conv_xx12_xx29: as_u16(dst) = swab16(as_u16(src)) ^ 0x80; goto CONV_END;
  204. conv_xx12_x920: as_u32(dst) = (u_int32_t)(as_u16(src) ^ 0x8000) << 8; goto CONV_END;
  205. conv_xx12_029x: as_u32(dst) = (u_int32_t)(swab16(as_u16(src)) ^ 0x80) << 8; goto CONV_END;
  206. conv_xx12_9200: as_u32(dst) = (u_int32_t)(as_u16(src) ^ 0x8000) << 16; goto CONV_END;
  207. conv_xx12_0029: as_u32(dst) = (u_int32_t)(swab16(as_u16(src)) ^ 0x80); goto CONV_END;
  208. conv_xx12_xxx2: as_u8(dst) = as_u16(src) & 0xff; goto CONV_END;
  209. conv_xx12_x210: as_u32(dst) = (u_int32_t)swab16(as_u16(src)) << 8; goto CONV_END;
  210. conv_xx12_012x: as_u32(dst) = (u_int32_t)as_u16(src) << 8; goto CONV_END;
  211. conv_xx12_2100: as_u32(dst) = (u_int32_t)swab16(as_u16(src)) << 16; goto CONV_END;
  212. conv_xx12_0012: as_u32(dst) = (u_int32_t)as_u16(src); goto CONV_END;
  213. conv_xx12_xxxA: as_u8(dst) = (as_u16(src) ^ 0x80) & 0xff; goto CONV_END;
  214. conv_xx12_xxA1: as_u16(dst) = swab16(as_u16(src) ^ 0x80); goto CONV_END;
  215. conv_xx12_xx1A: as_u16(dst) = as_u16(src) ^ 0x80; goto CONV_END;
  216. conv_xx12_xA10: as_u32(dst) = (u_int32_t)swab16(as_u16(src) ^ 0x80) << 8; goto CONV_END;
  217. conv_xx12_01Ax: as_u32(dst) = (u_int32_t)(as_u16(src) ^ 0x80) << 8; goto CONV_END;
  218. conv_xx12_A100: as_u32(dst) = (u_int32_t)swab16(as_u16(src) ^ 0x80) << 16; goto CONV_END;
  219. conv_xx12_001A: as_u32(dst) = (u_int32_t)(as_u16(src) ^ 0x80); goto CONV_END;
  220. conv_x123_xxx1: as_u8(dst) = as_u32(src) >> 16; goto CONV_END;
  221. conv_x123_xx12: as_u16(dst) = as_u32(src) >> 8; goto CONV_END;
  222. conv_x123_xx21: as_u16(dst) = swab16(as_u32(src) >> 8); goto CONV_END;
  223. conv_x123_x123: as_u32(dst) = as_u32(src); goto CONV_END;
  224. conv_x123_321x: as_u32(dst) = swab32(as_u32(src)); goto CONV_END;
  225. conv_x123_1230: as_u32(dst) = as_u32(src) << 8; goto CONV_END;
  226. conv_x123_0321: as_u32(dst) = swab32(as_u32(src)) >> 8; goto CONV_END;
  227. conv_x123_xxx9: as_u8(dst) = (as_u32(src) >> 16) ^ 0x80; goto CONV_END;
  228. conv_x123_xx92: as_u16(dst) = (as_u32(src) >> 8) ^ 0x8000; goto CONV_END;
  229. conv_x123_xx29: as_u16(dst) = swab16(as_u32(src) >> 8) ^ 0x80; goto CONV_END;
  230. conv_x123_x923: as_u32(dst) = as_u32(src) ^ 0x800000; goto CONV_END;
  231. conv_x123_329x: as_u32(dst) = swab32(as_u32(src)) ^ 0x8000; goto CONV_END;
  232. conv_x123_9230: as_u32(dst) = (as_u32(src) ^ 0x800000) << 8; goto CONV_END;
  233. conv_x123_0329: as_u32(dst) = (swab32(as_u32(src)) >> 8) ^ 0x80; goto CONV_END;
  234. conv_123x_xxx3: as_u8(dst) = (as_u32(src) >> 8) & 0xff; goto CONV_END;
  235. conv_123x_xx32: as_u16(dst) = swab16(as_u32(src) >> 8); goto CONV_END;
  236. conv_123x_xx23: as_u16(dst) = (as_u32(src) >> 8) & 0xffff; goto CONV_END;
  237. conv_123x_x321: as_u32(dst) = swab32(as_u32(src)); goto CONV_END;
  238. conv_123x_123x: as_u32(dst) = as_u32(src); goto CONV_END;
  239. conv_123x_3210: as_u32(dst) = swab32(as_u32(src)) << 8; goto CONV_END;
  240. conv_123x_0123: as_u32(dst) = as_u32(src) >> 8; goto CONV_END;
  241. conv_123x_xxxB: as_u8(dst) = ((as_u32(src) >> 8) & 0xff) ^ 0x80; goto CONV_END;
  242. conv_123x_xxB2: as_u16(dst) = swab16((as_u32(src) >> 8) ^ 0x80); goto CONV_END;
  243. conv_123x_xx2B: as_u16(dst) = ((as_u32(src) >> 8) & 0xffff) ^ 0x80; goto CONV_END;
  244. conv_123x_xB21: as_u32(dst) = swab32(as_u32(src)) ^ 0x800000; goto CONV_END;
  245. conv_123x_12Bx: as_u32(dst) = as_u32(src) ^ 0x8000; goto CONV_END;
  246. conv_123x_B210: as_u32(dst) = swab32(as_u32(src) ^ 0x8000) << 8; goto CONV_END;
  247. conv_123x_012B: as_u32(dst) = (as_u32(src) >> 8) ^ 0x80; goto CONV_END;
  248. conv_1234_xxx1: as_u8(dst) = as_u32(src) >> 24; goto CONV_END;
  249. conv_1234_xx12: as_u16(dst) = as_u32(src) >> 16; goto CONV_END;
  250. conv_1234_xx21: as_u16(dst) = swab16(as_u32(src) >> 16); goto CONV_END;
  251. conv_1234_x123: as_u32(dst) = as_u32(src) >> 8; goto CONV_END;
  252. conv_1234_321x: as_u32(dst) = swab32(as_u32(src)) << 8; goto CONV_END;
  253. conv_1234_1234: as_u32(dst) = as_u32(src); goto CONV_END;
  254. conv_1234_4321: as_u32(dst) = swab32(as_u32(src)); goto CONV_END;
  255. conv_1234_xxx9: as_u8(dst) = (as_u32(src) >> 24) ^ 0x80; goto CONV_END;
  256. conv_1234_xx92: as_u16(dst) = (as_u32(src) >> 16) ^ 0x8000; goto CONV_END;
  257. conv_1234_xx29: as_u16(dst) = swab16(as_u32(src) >> 16) ^ 0x80; goto CONV_END;
  258. conv_1234_x923: as_u32(dst) = (as_u32(src) >> 8) ^ 0x800000; goto CONV_END;
  259. conv_1234_329x: as_u32(dst) = (swab32(as_u32(src)) ^ 0x80) << 8; goto CONV_END;
  260. conv_1234_9234: as_u32(dst) = as_u32(src) ^ 0x80000000; goto CONV_END;
  261. conv_1234_4329: as_u32(dst) = swab32(as_u32(src)) ^ 0x80; goto CONV_END;
  262. conv_1234_xxx4: as_u8(dst) = as_u32(src) & 0xff; goto CONV_END;
  263. conv_1234_xx43: as_u16(dst) = swab16(as_u32(src)); goto CONV_END;
  264. conv_1234_xx34: as_u16(dst) = as_u32(src) & 0xffff; goto CONV_END;
  265. conv_1234_x432: as_u32(dst) = swab32(as_u32(src)) >> 8; goto CONV_END;
  266. conv_1234_234x: as_u32(dst) = as_u32(src) << 8; goto CONV_END;
  267. conv_1234_xxxC: as_u8(dst) = (as_u32(src) & 0xff) ^ 0x80; goto CONV_END;
  268. conv_1234_xxC3: as_u16(dst) = swab16(as_u32(src) ^ 0x80); goto CONV_END;
  269. conv_1234_xx3C: as_u16(dst) = (as_u32(src) & 0xffff) ^ 0x80; goto CONV_END;
  270. conv_1234_xC32: as_u32(dst) = (swab32(as_u32(src)) >> 8) ^ 0x800000; goto CONV_END;
  271. conv_1234_23Cx: as_u32(dst) = (as_u32(src) ^ 0x80) << 8; goto CONV_END;
  272. conv_1234_C321: as_u32(dst) = swab32(as_u32(src) ^ 0x80); goto CONV_END;
  273. conv_1234_123C: as_u32(dst) = as_u32(src) ^ 0x80; goto CONV_END;
  274. }
  275. #endif
  276. #ifdef GET_S16_LABELS
  277. /* src_wid src_endswap unsigned */
  278. static void *get_s16_labels[4 * 2 * 2] = {
  279. &&get_s16_xxx1_xx10, /* 8h -> 16h */
  280. &&get_s16_xxx1_xx90, /* 8h ^> 16h */
  281. &&get_s16_xxx1_xx10, /* 8s -> 16h */
  282. &&get_s16_xxx1_xx90, /* 8s ^> 16h */
  283. &&get_s16_xx12_xx12, /* 16h -> 16h */
  284. &&get_s16_xx12_xx92, /* 16h ^> 16h */
  285. &&get_s16_xx12_xx21, /* 16s -> 16h */
  286. &&get_s16_xx12_xxA1, /* 16s ^> 16h */
  287. &&get_s16_x123_xx12, /* 24h -> 16h */
  288. &&get_s16_x123_xx92, /* 24h ^> 16h */
  289. &&get_s16_123x_xx32, /* 24s -> 16h */
  290. &&get_s16_123x_xxB2, /* 24s ^> 16h */
  291. &&get_s16_1234_xx12, /* 32h -> 16h */
  292. &&get_s16_1234_xx92, /* 32h ^> 16h */
  293. &&get_s16_1234_xx43, /* 32s -> 16h */
  294. &&get_s16_1234_xxC3, /* 32s ^> 16h */
  295. };
  296. #endif
  297. #ifdef GET_S16_END
  298. while(0) {
  299. get_s16_xxx1_xx10: sample = (u_int16_t)as_u8(src) << 8; goto GET_S16_END;
  300. get_s16_xxx1_xx90: sample = (u_int16_t)(as_u8(src) ^ 0x80) << 8; goto GET_S16_END;
  301. get_s16_xx12_xx12: sample = as_u16(src); goto GET_S16_END;
  302. get_s16_xx12_xx92: sample = as_u16(src) ^ 0x8000; goto GET_S16_END;
  303. get_s16_xx12_xx21: sample = swab16(as_u16(src)); goto GET_S16_END;
  304. get_s16_xx12_xxA1: sample = swab16(as_u16(src) ^ 0x80); goto GET_S16_END;
  305. get_s16_x123_xx12: sample = as_u32(src) >> 8; goto GET_S16_END;
  306. get_s16_x123_xx92: sample = (as_u32(src) >> 8) ^ 0x8000; goto GET_S16_END;
  307. get_s16_123x_xx32: sample = swab16(as_u32(src) >> 8); goto GET_S16_END;
  308. get_s16_123x_xxB2: sample = swab16((as_u32(src) >> 8) ^ 0x8000); goto GET_S16_END;
  309. get_s16_1234_xx12: sample = as_u32(src) >> 16; goto GET_S16_END;
  310. get_s16_1234_xx92: sample = (as_u32(src) >> 16) ^ 0x8000; goto GET_S16_END;
  311. get_s16_1234_xx43: sample = swab16(as_u32(src)); goto GET_S16_END;
  312. get_s16_1234_xxC3: sample = swab16(as_u32(src) ^ 0x80); goto GET_S16_END;
  313. }
  314. #endif
  315. #ifdef PUT_S16_LABELS
  316. /* dst_wid dst_endswap unsigned */
  317. static void *put_s16_labels[4 * 2 * 2] = {
  318. &&put_s16_xx12_xxx1, /* 16h -> 8h */
  319. &&put_s16_xx12_xxx9, /* 16h ^> 8h */
  320. &&put_s16_xx12_xxx1, /* 16h -> 8s */
  321. &&put_s16_xx12_xxx9, /* 16h ^> 8s */
  322. &&put_s16_xx12_xx12, /* 16h -> 16h */
  323. &&put_s16_xx12_xx92, /* 16h ^> 16h */
  324. &&put_s16_xx12_xx21, /* 16h -> 16s */
  325. &&put_s16_xx12_xx29, /* 16h ^> 16s */
  326. &&put_s16_xx12_x120, /* 16h -> 24h */
  327. &&put_s16_xx12_x920, /* 16h ^> 24h */
  328. &&put_s16_xx12_021x, /* 16h -> 24s */
  329. &&put_s16_xx12_029x, /* 16h ^> 24s */
  330. &&put_s16_xx12_1200, /* 16h -> 32h */
  331. &&put_s16_xx12_9200, /* 16h ^> 32h */
  332. &&put_s16_xx12_0021, /* 16h -> 32s */
  333. &&put_s16_xx12_0029, /* 16h ^> 32s */
  334. };
  335. #endif
  336. #ifdef PUT_S16_END
  337. while (0) {
  338. put_s16_xx12_xxx1: as_u8(dst) = sample >> 8; goto PUT_S16_END;
  339. put_s16_xx12_xxx9: as_u8(dst) = (sample >> 8) ^ 0x80; goto PUT_S16_END;
  340. put_s16_xx12_xx12: as_u16(dst) = sample; goto PUT_S16_END;
  341. put_s16_xx12_xx92: as_u16(dst) = sample ^ 0x8000; goto PUT_S16_END;
  342. put_s16_xx12_xx21: as_u16(dst) = swab16(sample); goto PUT_S16_END;
  343. put_s16_xx12_xx29: as_u16(dst) = swab16(sample) ^ 0x80; goto PUT_S16_END;
  344. put_s16_xx12_x120: as_u32(dst) = (u_int32_t)sample << 8; goto PUT_S16_END;
  345. put_s16_xx12_x920: as_u32(dst) = (u_int32_t)(sample ^ 0x8000) << 8; goto PUT_S16_END;
  346. put_s16_xx12_021x: as_u32(dst) = (u_int32_t)swab16(sample) << 8; goto PUT_S16_END;
  347. put_s16_xx12_029x: as_u32(dst) = (u_int32_t)(swab16(sample) ^ 0x80) << 8; goto PUT_S16_END;
  348. put_s16_xx12_1200: as_u32(dst) = (u_int32_t)sample << 16; goto PUT_S16_END;
  349. put_s16_xx12_9200: as_u32(dst) = (u_int32_t)(sample ^ 0x8000) << 16; goto PUT_S16_END;
  350. put_s16_xx12_0021: as_u32(dst) = (u_int32_t)swab16(sample); goto PUT_S16_END;
  351. put_s16_xx12_0029: as_u32(dst) = (u_int32_t)swab16(sample) ^ 0x80; goto PUT_S16_END;
  352. }
  353. #endif
  354. #undef as_u8
  355. #undef as_u16
  356. #undef as_u32
  357. #undef as_s8
  358. #undef as_s16
  359. #undef as_s32