carray 3.0.7 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/CHANGELOG.md +7 -1940
  4. data/README.md +38 -32
  5. data/carray.gemspec +16 -4
  6. data/docs/changelogs/CHANGELOG-3.0.md +2464 -0
  7. data/ext/ca_array_pool.c +4 -5
  8. data/ext/ca_axis_descriptor.h +45 -30
  9. data/ext/ca_axis_dispatch.c +7 -4
  10. data/ext/ca_axis_group.c +6 -9
  11. data/ext/ca_bincmp_dispatch.h +16 -38
  12. data/ext/ca_binop_dispatch.c +27 -0
  13. data/ext/ca_binop_dispatch.h +22 -47
  14. data/ext/ca_categorical_iterator.c +36 -34
  15. data/ext/ca_compare.c +0 -1
  16. data/ext/ca_compare.h +8 -1
  17. data/ext/ca_composite_dispatch.h +6 -0
  18. data/ext/ca_for_buffer.h +6 -1
  19. data/ext/ca_group_iter.c +17 -18
  20. data/ext/ca_iter_state_fields.h +196 -0
  21. data/ext/ca_iter_substrate.h +84 -103
  22. data/ext/ca_kernel_iterator.c +125 -89
  23. data/ext/ca_kernel_iterator.h +229 -1506
  24. data/ext/ca_kernel_iterator_internal.h +1167 -0
  25. data/ext/ca_moncmp_dispatch.h +17 -24
  26. data/ext/ca_monop_dispatch.h +25 -74
  27. data/ext/ca_obj_array.c +90 -163
  28. data/ext/ca_obj_bincmp.c +47 -46
  29. data/ext/ca_obj_binop.c +38 -38
  30. data/ext/ca_obj_bitarray.c +5 -17
  31. data/ext/ca_obj_bitfield.c +15 -30
  32. data/ext/ca_obj_block.c +11 -12
  33. data/ext/ca_obj_byte_swap.c +32 -30
  34. data/ext/ca_obj_const_string.c +57 -62
  35. data/ext/ca_obj_face.c +99 -91
  36. data/ext/ca_obj_face.h +32 -170
  37. data/ext/ca_obj_fake.c +15 -21
  38. data/ext/ca_obj_farray.c +7 -9
  39. data/ext/ca_obj_field.c +17 -13
  40. data/ext/ca_obj_fixlen_string.c +8 -19
  41. data/ext/ca_obj_grid.c +137 -106
  42. data/ext/ca_obj_meld.c +23 -21
  43. data/ext/ca_obj_moncmp.c +10 -21
  44. data/ext/ca_obj_monop.c +24 -35
  45. data/ext/ca_obj_object.c +51 -37
  46. data/ext/ca_obj_record.c +74 -22
  47. data/ext/ca_obj_reduce.c +8 -10
  48. data/ext/ca_obj_refer.c +42 -29
  49. data/ext/ca_obj_remap.c +11 -29
  50. data/ext/ca_obj_repeat.c +41 -23
  51. data/ext/ca_obj_roll.c +18 -24
  52. data/ext/ca_obj_select.c +10 -22
  53. data/ext/ca_obj_select_axis.c +27 -36
  54. data/ext/ca_obj_shift.c +22 -42
  55. data/ext/ca_obj_source.c +1 -5
  56. data/ext/ca_obj_stack.c +28 -24
  57. data/ext/ca_obj_stride.c +53 -54
  58. data/ext/ca_obj_string.c +6 -18
  59. data/ext/ca_obj_tile.c +12 -12
  60. data/ext/ca_obj_time.c +12 -23
  61. data/ext/ca_obj_timedelta.c +12 -23
  62. data/ext/ca_obj_transpose.c +8 -10
  63. data/ext/ca_obj_triop.c +35 -39
  64. data/ext/ca_obj_window.c +67 -86
  65. data/ext/ca_op_cmplx64.h +4 -0
  66. data/ext/ca_op_ipower.c +34 -12
  67. data/ext/ca_op_powi.h +4 -0
  68. data/ext/ca_pow5_table.h +2 -1
  69. data/ext/ca_rng_normal.h +4 -0
  70. data/ext/ca_rng_xoshiro256pp.h +3 -0
  71. data/ext/ca_sort_kernels.h +20 -26
  72. data/ext/ca_sweep_engine.c +2 -3
  73. data/ext/ca_sweep_engine.h +17 -9
  74. data/ext/ca_transform_common.c +3 -8
  75. data/ext/ca_triop_dispatch.h +20 -32
  76. data/ext/caframe_csv_reader.c +11 -11
  77. data/ext/carray.h +300 -1011
  78. data/ext/carray_access.c +234 -180
  79. data/ext/carray_address_basis.c +33 -38
  80. data/ext/carray_attribute.c +81 -104
  81. data/ext/carray_bincount.c +12 -14
  82. data/ext/carray_broadcast.c +30 -26
  83. data/ext/carray_call_cfunc.c +169 -277
  84. data/ext/carray_call_cfunc.h +36 -28
  85. data/ext/carray_cast.c +912 -346
  86. data/ext/carray_cast_func.rb +31 -3
  87. data/ext/carray_class.c +6 -11
  88. data/ext/carray_conversion.c +43 -38
  89. data/ext/carray_copy.c +28 -26
  90. data/ext/carray_core.c +217 -126
  91. data/ext/carray_count.c +27 -15
  92. data/ext/carray_element.c +40 -25
  93. data/ext/carray_factorize.c +53 -52
  94. data/ext/carray_generate.c +26 -19
  95. data/ext/carray_histogram.c +8 -10
  96. data/ext/carray_hold.c +7 -9
  97. data/ext/carray_index_classifier.c +123 -228
  98. data/ext/carray_index_classifier.h +11 -10
  99. data/ext/carray_integer_total.c +523 -0
  100. data/ext/carray_internal.h +1274 -160
  101. data/ext/carray_key_windows.c +3 -3
  102. data/ext/carray_lazy.c +21 -36
  103. data/ext/carray_loop.c +19 -22
  104. data/ext/carray_mask.c +123 -145
  105. data/ext/carray_math_kernel.h +23 -47
  106. data/ext/carray_mathfunc.c +10 -3
  107. data/ext/carray_median_percentile.c +95 -94
  108. data/ext/carray_memory_view.c +42 -47
  109. data/ext/carray_operator.c +423 -122
  110. data/ext/carray_order.c +121 -85
  111. data/ext/carray_partition.c +13 -15
  112. data/ext/carray_random.c +47 -41
  113. data/ext/carray_round.c +9 -4
  114. data/ext/carray_scatter.c +54 -40
  115. data/ext/carray_segment.c +41 -45
  116. data/ext/carray_slab.c +64 -47
  117. data/ext/carray_slab.h +44 -33
  118. data/ext/carray_sort.c +32 -29
  119. data/ext/carray_sort_kernel.c +12 -10
  120. data/ext/carray_struct.c +38 -43
  121. data/ext/carray_test.c +47 -43
  122. data/ext/carray_time_text.c +24 -31
  123. data/ext/carray_undef.c +50 -7
  124. data/ext/carray_utils.c +258 -94
  125. data/ext/extconf.rb +24 -17
  126. data/ext/mk_call_cfunc.rb +19 -20
  127. data/ext/mk_pow5_table.rb +2 -1
  128. data/ext/mkkernel.rb +782 -461
  129. data/ext/ruby_carray.c +47 -42
  130. data/ext/version.h +7 -5
  131. data/lib/carray/attribute.rb +19 -18
  132. data/lib/carray/autoload_carray.rb +20 -15
  133. data/lib/carray/autoload_method_extension.rb +64 -57
  134. data/lib/carray/axis_group.rb +264 -180
  135. data/lib/carray/basics.rb +272 -48
  136. data/lib/carray/bincount_nd.rb +33 -16
  137. data/lib/carray/block_iterator.rb +123 -102
  138. data/lib/carray/boolean_reduce.rb +7 -4
  139. data/lib/carray/categorical.rb +63 -51
  140. data/lib/carray/categorical_iterator.rb +89 -67
  141. data/lib/carray/complex.rb +61 -41
  142. data/lib/carray/conditional.rb +49 -22
  143. data/lib/carray/const_string.rb +54 -62
  144. data/lib/carray/core_extensions.rb +1 -1
  145. data/lib/carray/distance_limit.rb +7 -5
  146. data/lib/carray/factories.rb +269 -0
  147. data/lib/carray/fixlen_string.rb +25 -24
  148. data/lib/carray/frame/column_verbs.rb +20 -8
  149. data/lib/carray/frame/concat.rb +3 -3
  150. data/lib/carray/frame/convert.rb +2 -1
  151. data/lib/carray/frame/csv_parser.rb +7 -1
  152. data/lib/carray/frame/frame.rb +35 -25
  153. data/lib/carray/frame/group.rb +183 -150
  154. data/lib/carray/frame/io.rb +26 -7
  155. data/lib/carray/frame/join.rb +37 -12
  156. data/lib/carray/frame/records.rb +1 -1
  157. data/lib/carray/frame/reshape.rb +3 -3
  158. data/lib/carray/frame/sort.rb +10 -8
  159. data/lib/carray/frame/verbs.rb +148 -118
  160. data/lib/carray/frame/windows.rb +232 -21
  161. data/lib/carray/frame.rb +1 -2
  162. data/lib/carray/fuse_source.rb +24 -21
  163. data/lib/carray/fusion.rb +30 -30
  164. data/lib/carray/histogram.rb +35 -16
  165. data/lib/carray/inspect.rb +7 -7
  166. data/lib/carray/iterator.rb +97 -24
  167. data/lib/carray/key_windows.rb +83 -57
  168. data/lib/carray/lazy.rb +196 -94
  169. data/lib/carray/limits.rb +80 -0
  170. data/lib/carray/mask_gap_fill.rb +21 -16
  171. data/lib/carray/math.rb +87 -50
  172. data/lib/carray/meld_reduce.rb +30 -8
  173. data/lib/carray/methods/align_addr.rb +29 -17
  174. data/lib/carray/methods/bin.rb +5 -1
  175. data/lib/carray/methods/bincount.rb +4 -2
  176. data/lib/carray/methods/bit_string.rb +19 -31
  177. data/lib/carray/methods/broadcast.rb +8 -3
  178. data/lib/carray/methods/choose.rb +5 -5
  179. data/lib/carray/methods/composition.rb +72 -71
  180. data/lib/carray/methods/{index.rb → coordinate.rb} +13 -13
  181. data/lib/carray/methods/discovery_along.rb +3 -3
  182. data/lib/carray/methods/gather_nd.rb +106 -106
  183. data/lib/carray/methods/insert_block.rb +2 -2
  184. data/lib/carray/methods/is_between.rb +6 -4
  185. data/lib/carray/methods/is_in.rb +165 -145
  186. data/lib/carray/methods/join.rb +2 -1
  187. data/lib/carray/methods/lag.rb +6 -2
  188. data/lib/carray/methods/locate_addr.rb +150 -138
  189. data/lib/carray/methods/mask_duplicates.rb +1 -1
  190. data/lib/carray/methods/meshgrid.rb +28 -16
  191. data/lib/carray/methods/mode.rb +67 -67
  192. data/lib/carray/methods/nunique.rb +9 -7
  193. data/lib/carray/methods/repeat.rb +12 -12
  194. data/lib/carray/methods/resize.rb +1 -1
  195. data/lib/carray/methods/snap.rb +24 -20
  196. data/lib/carray/methods/string_format.rb +2 -2
  197. data/lib/carray/methods/unique.rb +4 -2
  198. data/lib/carray/methods/value_counts.rb +1 -1
  199. data/lib/carray/mkmf.rb +25 -28
  200. data/lib/carray/percentile_arguments.rb +82 -0
  201. data/lib/carray/record_order.rb +18 -17
  202. data/lib/carray/rng.rb +1 -0
  203. data/lib/carray/runtime.rb +190 -22
  204. data/lib/carray/segment_iterator.rb +251 -129
  205. data/lib/carray/serialize.rb +618 -571
  206. data/lib/carray/slab_iterator.rb +114 -114
  207. data/lib/carray/stack.rb +11 -12
  208. data/lib/carray/string.rb +16 -22
  209. data/lib/carray/string_operation_extension.rb +76 -52
  210. data/lib/carray/struct.rb +122 -164
  211. data/lib/carray/struct_builder.rb +243 -72
  212. data/lib/carray/time.rb +496 -342
  213. data/lib/carray/window_iterator.rb +191 -150
  214. data/lib/carray.rb +6 -11
  215. data/yard-stubs/ca_obj_array.rb +20 -135
  216. data/yard-stubs/ca_obj_bitarray.rb +1 -8
  217. data/yard-stubs/ca_obj_bitfield.rb +4 -3
  218. data/yard-stubs/ca_obj_byte_swap.rb +21 -7
  219. data/yard-stubs/ca_obj_fake.rb +3 -1
  220. data/yard-stubs/ca_obj_farray.rb +1 -1
  221. data/yard-stubs/ca_obj_field.rb +8 -6
  222. data/yard-stubs/ca_obj_refer.rb +7 -5
  223. data/yard-stubs/ca_obj_roll.rb +7 -6
  224. data/yard-stubs/ca_obj_shift.rb +2 -3
  225. data/yard-stubs/ca_obj_stride.rb +5 -7
  226. data/yard-stubs/ca_obj_tile.rb +1 -1
  227. data/yard-stubs/ca_obj_time.rb +43 -0
  228. data/yard-stubs/ca_obj_transpose.rb +1 -1
  229. data/yard-stubs/ca_obj_window.rb +26 -15
  230. data/yard-stubs/carray_access.rb +51 -4
  231. data/yard-stubs/carray_attribute.rb +26 -38
  232. data/yard-stubs/carray_cast.rb +118 -165
  233. data/yard-stubs/carray_class.rb +3 -4
  234. data/yard-stubs/carray_conversion.rb +6 -7
  235. data/yard-stubs/carray_copy.rb +2 -1
  236. data/yard-stubs/carray_count.rb +5 -3
  237. data/yard-stubs/carray_element.rb +4 -3
  238. data/yard-stubs/carray_limits.rb +100 -0
  239. data/yard-stubs/carray_loop.rb +0 -20
  240. data/yard-stubs/carray_mask.rb +59 -41
  241. data/yard-stubs/carray_math.rb +157 -100
  242. data/yard-stubs/carray_mathfunc.rb +415 -3
  243. data/yard-stubs/carray_median_percentile.rb +29 -11
  244. data/yard-stubs/carray_memory_view.rb +2 -2
  245. data/yard-stubs/carray_order.rb +67 -34
  246. data/yard-stubs/carray_random.rb +6 -6
  247. data/yard-stubs/carray_reduce.rb +353 -0
  248. data/yard-stubs/carray_rng.rb +92 -0
  249. data/yard-stubs/carray_scatter.rb +10 -2
  250. data/yard-stubs/carray_slab.rb +7 -4
  251. data/yard-stubs/carray_sort.rb +7 -6
  252. data/yard-stubs/carray_undef.rb +44 -5
  253. data/yard-stubs/ruby_carray.rb +75 -40
  254. metadata +62 -24
  255. data/CHANGELOG.v1.md +0 -126
  256. data/ext/carray_build_flags.h +0 -3
  257. data/ext/carray_config.h +0 -28
  258. data/ext/carray_data_type.c +0 -90
  259. data/ext/carray_kernels_bincmp.c +0 -6457
  260. data/ext/carray_kernels_binop.c +0 -31534
  261. data/ext/carray_kernels_init.c +0 -1734
  262. data/ext/carray_kernels_moncmp.c +0 -2104
  263. data/ext/carray_kernels_monop.c +0 -25337
  264. data/ext/carray_kernels_reduce_aggregate.c +0 -27545
  265. data/ext/carray_kernels_reduce_boolean.c +0 -1924
  266. data/ext/carray_kernels_reduce_cumulative.c +0 -11646
  267. data/ext/carray_kernels_reduce_extreme.c +0 -21631
  268. data/ext/carray_kernels_reduce_variance.c +0 -5981
  269. data/ext/carray_kernels_scan.c +0 -4302
  270. data/ext/carray_kernels_search.c +0 -37776
  271. data/ext/carray_kernels_sort.c +0 -10814
  272. data/ext/carray_kernels_triop.c +0 -1864
  273. data/lib/carray/construct.rb +0 -360
  274. data/lib/carray/data_type_extension.rb +0 -262
  275. data/lib/carray/data_type_limits.rb +0 -91
@@ -1,1734 +0,0 @@
1
- /* GENERATED aggregator: dispatches to per-tag Init_carray_kernels_<tag>() */
2
- #include "carray.h"
3
-
4
- void Init_carray_kernels_reduce_aggregate (void);
5
- void Init_carray_kernels_reduce_extreme (void);
6
- void Init_carray_kernels_reduce_boolean (void);
7
- void Init_carray_kernels_reduce_variance (void);
8
- void Init_carray_kernels_reduce_cumulative (void);
9
- void Init_carray_kernels_scan (void);
10
- void Init_carray_kernels_sort (void);
11
- void Init_carray_kernels_search (void);
12
- void Init_carray_kernels_monop (void);
13
- void Init_carray_kernels_binop (void);
14
- void Init_carray_kernels_triop (void);
15
- void Init_carray_kernels_moncmp (void);
16
- void Init_carray_kernels_bincmp (void);
17
-
18
-
19
- /* The text of every kernel body, for a caller that compiles the same
20
- operation elsewhere. Placeholders are left in place. */
21
-
22
- typedef struct {
23
- const char *kind;
24
- const char *name;
25
- const char *data_type;
26
- const char *body;
27
- } ca_kernel_body_t;
28
-
29
- static const ca_kernel_body_t ca_kernel_bodies[] = {
30
- { "binop", "ipow", "float32",
31
- "(#3) = (#2) == 2 ? (#1) * (#1) : (#2) == 3 ? (#1) * (#1) * (#1) : (#2) == 4 ? ((#1) * (#1)) * ((#1) * (#1)) : (#2) == 1 ? (#1) : (#2) == 0 ? 1 : (#2) == -1 ? 1 / (#1) : (#2) == -2 ? 1 / ((#1) * (#1)) : powf((#1), (float)(double)(#2));" },
32
- { "binop", "ipow", "float64",
33
- "(#3) = (#2) == 2 ? (#1) * (#1) : (#2) == 3 ? (#1) * (#1) * (#1) : (#2) == 4 ? ((#1) * (#1)) * ((#1) * (#1)) : (#2) == 1 ? (#1) : (#2) == 0 ? 1 : (#2) == -1 ? 1 / (#1) : (#2) == -2 ? 1 / ((#1) * (#1)) : pow((#1), (double)(#2));" },
34
- { "binop", "ipow", "cmplx64",
35
- "(#3) = (#2) == 2 ? (#1) * (#1) : (#2) == 3 ? (#1) * (#1) * (#1) : (#2) == 4 ? ((#1) * (#1)) * ((#1) * (#1)) : (#2) == 1 ? (#1) : (#2) == 0 ? 1 : (#2) == -1 ? 1 / (#1) : (#2) == -2 ? 1 / ((#1) * (#1)) : cpow((#1), (float)(double)(#2));" },
36
- { "binop", "ipow", "cmplx128",
37
- "(#3) = (#2) == 2 ? (#1) * (#1) : (#2) == 3 ? (#1) * (#1) * (#1) : (#2) == 4 ? ((#1) * (#1)) * ((#1) * (#1)) : (#2) == 1 ? (#1) : (#2) == 0 ? 1 : (#2) == -1 ? 1 / (#1) : (#2) == -2 ? 1 / ((#1) * (#1)) : cpow((#1), (double)(#2));" },
38
- { "monop", "cast_int8", "boolean",
39
- "(#2) = (int8_t)(#1);" },
40
- { "monop", "cast_uint8", "boolean",
41
- "(#2) = (uint8_t)(#1);" },
42
- { "monop", "cast_int16", "boolean",
43
- "(#2) = (int16_t)(#1);" },
44
- { "monop", "cast_uint16", "boolean",
45
- "(#2) = (uint16_t)(#1);" },
46
- { "monop", "cast_int32", "boolean",
47
- "(#2) = (int32_t)(#1);" },
48
- { "monop", "cast_uint32", "boolean",
49
- "(#2) = (uint32_t)(#1);" },
50
- { "monop", "cast_int64", "boolean",
51
- "(#2) = (int64_t)(#1);" },
52
- { "monop", "cast_uint64", "boolean",
53
- "(#2) = (uint64_t)(#1);" },
54
- { "monop", "cast_float32", "boolean",
55
- "(#2) = (float)(#1);" },
56
- { "monop", "cast_float64", "boolean",
57
- "(#2) = (double)(#1);" },
58
- { "monop", "cast_cmplx64", "boolean",
59
- "(#2) = (cmplx64_t)(#1);" },
60
- { "monop", "cast_cmplx128", "boolean",
61
- "(#2) = (cmplx128_t)(#1);" },
62
- { "monop", "cast_int8", "int8",
63
- "(#2) = (int8_t)(#1);" },
64
- { "monop", "cast_uint8", "int8",
65
- "(#2) = (uint8_t)(#1);" },
66
- { "monop", "cast_int16", "int8",
67
- "(#2) = (int16_t)(#1);" },
68
- { "monop", "cast_uint16", "int8",
69
- "(#2) = (uint16_t)(#1);" },
70
- { "monop", "cast_int32", "int8",
71
- "(#2) = (int32_t)(#1);" },
72
- { "monop", "cast_uint32", "int8",
73
- "(#2) = (uint32_t)(#1);" },
74
- { "monop", "cast_int64", "int8",
75
- "(#2) = (int64_t)(#1);" },
76
- { "monop", "cast_uint64", "int8",
77
- "(#2) = (uint64_t)(#1);" },
78
- { "monop", "cast_float32", "int8",
79
- "(#2) = (float)(#1);" },
80
- { "monop", "cast_float64", "int8",
81
- "(#2) = (double)(#1);" },
82
- { "monop", "cast_cmplx64", "int8",
83
- "(#2) = (cmplx64_t)(#1);" },
84
- { "monop", "cast_cmplx128", "int8",
85
- "(#2) = (cmplx128_t)(#1);" },
86
- { "monop", "cast_int8", "uint8",
87
- "(#2) = (int8_t)(#1);" },
88
- { "monop", "cast_uint8", "uint8",
89
- "(#2) = (uint8_t)(#1);" },
90
- { "monop", "cast_int16", "uint8",
91
- "(#2) = (int16_t)(#1);" },
92
- { "monop", "cast_uint16", "uint8",
93
- "(#2) = (uint16_t)(#1);" },
94
- { "monop", "cast_int32", "uint8",
95
- "(#2) = (int32_t)(#1);" },
96
- { "monop", "cast_uint32", "uint8",
97
- "(#2) = (uint32_t)(#1);" },
98
- { "monop", "cast_int64", "uint8",
99
- "(#2) = (int64_t)(#1);" },
100
- { "monop", "cast_uint64", "uint8",
101
- "(#2) = (uint64_t)(#1);" },
102
- { "monop", "cast_float32", "uint8",
103
- "(#2) = (float)(#1);" },
104
- { "monop", "cast_float64", "uint8",
105
- "(#2) = (double)(#1);" },
106
- { "monop", "cast_cmplx64", "uint8",
107
- "(#2) = (cmplx64_t)(#1);" },
108
- { "monop", "cast_cmplx128", "uint8",
109
- "(#2) = (cmplx128_t)(#1);" },
110
- { "monop", "cast_int8", "int16",
111
- "(#2) = (int8_t)(#1);" },
112
- { "monop", "cast_uint8", "int16",
113
- "(#2) = (uint8_t)(#1);" },
114
- { "monop", "cast_int16", "int16",
115
- "(#2) = (int16_t)(#1);" },
116
- { "monop", "cast_uint16", "int16",
117
- "(#2) = (uint16_t)(#1);" },
118
- { "monop", "cast_int32", "int16",
119
- "(#2) = (int32_t)(#1);" },
120
- { "monop", "cast_uint32", "int16",
121
- "(#2) = (uint32_t)(#1);" },
122
- { "monop", "cast_int64", "int16",
123
- "(#2) = (int64_t)(#1);" },
124
- { "monop", "cast_uint64", "int16",
125
- "(#2) = (uint64_t)(#1);" },
126
- { "monop", "cast_float32", "int16",
127
- "(#2) = (float)(#1);" },
128
- { "monop", "cast_float64", "int16",
129
- "(#2) = (double)(#1);" },
130
- { "monop", "cast_cmplx64", "int16",
131
- "(#2) = (cmplx64_t)(#1);" },
132
- { "monop", "cast_cmplx128", "int16",
133
- "(#2) = (cmplx128_t)(#1);" },
134
- { "monop", "cast_int8", "uint16",
135
- "(#2) = (int8_t)(#1);" },
136
- { "monop", "cast_uint8", "uint16",
137
- "(#2) = (uint8_t)(#1);" },
138
- { "monop", "cast_int16", "uint16",
139
- "(#2) = (int16_t)(#1);" },
140
- { "monop", "cast_uint16", "uint16",
141
- "(#2) = (uint16_t)(#1);" },
142
- { "monop", "cast_int32", "uint16",
143
- "(#2) = (int32_t)(#1);" },
144
- { "monop", "cast_uint32", "uint16",
145
- "(#2) = (uint32_t)(#1);" },
146
- { "monop", "cast_int64", "uint16",
147
- "(#2) = (int64_t)(#1);" },
148
- { "monop", "cast_uint64", "uint16",
149
- "(#2) = (uint64_t)(#1);" },
150
- { "monop", "cast_float32", "uint16",
151
- "(#2) = (float)(#1);" },
152
- { "monop", "cast_float64", "uint16",
153
- "(#2) = (double)(#1);" },
154
- { "monop", "cast_cmplx64", "uint16",
155
- "(#2) = (cmplx64_t)(#1);" },
156
- { "monop", "cast_cmplx128", "uint16",
157
- "(#2) = (cmplx128_t)(#1);" },
158
- { "monop", "cast_int8", "int32",
159
- "(#2) = (int8_t)(#1);" },
160
- { "monop", "cast_uint8", "int32",
161
- "(#2) = (uint8_t)(#1);" },
162
- { "monop", "cast_int16", "int32",
163
- "(#2) = (int16_t)(#1);" },
164
- { "monop", "cast_uint16", "int32",
165
- "(#2) = (uint16_t)(#1);" },
166
- { "monop", "cast_int32", "int32",
167
- "(#2) = (int32_t)(#1);" },
168
- { "monop", "cast_uint32", "int32",
169
- "(#2) = (uint32_t)(#1);" },
170
- { "monop", "cast_int64", "int32",
171
- "(#2) = (int64_t)(#1);" },
172
- { "monop", "cast_uint64", "int32",
173
- "(#2) = (uint64_t)(#1);" },
174
- { "monop", "cast_float32", "int32",
175
- "(#2) = (float)(#1);" },
176
- { "monop", "cast_float64", "int32",
177
- "(#2) = (double)(#1);" },
178
- { "monop", "cast_cmplx64", "int32",
179
- "(#2) = (cmplx64_t)(#1);" },
180
- { "monop", "cast_cmplx128", "int32",
181
- "(#2) = (cmplx128_t)(#1);" },
182
- { "monop", "cast_int8", "uint32",
183
- "(#2) = (int8_t)(#1);" },
184
- { "monop", "cast_uint8", "uint32",
185
- "(#2) = (uint8_t)(#1);" },
186
- { "monop", "cast_int16", "uint32",
187
- "(#2) = (int16_t)(#1);" },
188
- { "monop", "cast_uint16", "uint32",
189
- "(#2) = (uint16_t)(#1);" },
190
- { "monop", "cast_int32", "uint32",
191
- "(#2) = (int32_t)(#1);" },
192
- { "monop", "cast_uint32", "uint32",
193
- "(#2) = (uint32_t)(#1);" },
194
- { "monop", "cast_int64", "uint32",
195
- "(#2) = (int64_t)(#1);" },
196
- { "monop", "cast_uint64", "uint32",
197
- "(#2) = (uint64_t)(#1);" },
198
- { "monop", "cast_float32", "uint32",
199
- "(#2) = (float)(#1);" },
200
- { "monop", "cast_float64", "uint32",
201
- "(#2) = (double)(#1);" },
202
- { "monop", "cast_cmplx64", "uint32",
203
- "(#2) = (cmplx64_t)(#1);" },
204
- { "monop", "cast_cmplx128", "uint32",
205
- "(#2) = (cmplx128_t)(#1);" },
206
- { "monop", "cast_int8", "int64",
207
- "(#2) = (int8_t)(#1);" },
208
- { "monop", "cast_uint8", "int64",
209
- "(#2) = (uint8_t)(#1);" },
210
- { "monop", "cast_int16", "int64",
211
- "(#2) = (int16_t)(#1);" },
212
- { "monop", "cast_uint16", "int64",
213
- "(#2) = (uint16_t)(#1);" },
214
- { "monop", "cast_int32", "int64",
215
- "(#2) = (int32_t)(#1);" },
216
- { "monop", "cast_uint32", "int64",
217
- "(#2) = (uint32_t)(#1);" },
218
- { "monop", "cast_int64", "int64",
219
- "(#2) = (int64_t)(#1);" },
220
- { "monop", "cast_uint64", "int64",
221
- "(#2) = (uint64_t)(#1);" },
222
- { "monop", "cast_float32", "int64",
223
- "(#2) = (float)(double)(#1);" },
224
- { "monop", "cast_float64", "int64",
225
- "(#2) = (double)(#1);" },
226
- { "monop", "cast_cmplx64", "int64",
227
- "(#2) = (cmplx64_t)(double)(#1);" },
228
- { "monop", "cast_cmplx128", "int64",
229
- "(#2) = (cmplx128_t)(#1);" },
230
- { "monop", "cast_int8", "uint64",
231
- "(#2) = (int8_t)(#1);" },
232
- { "monop", "cast_uint8", "uint64",
233
- "(#2) = (uint8_t)(#1);" },
234
- { "monop", "cast_int16", "uint64",
235
- "(#2) = (int16_t)(#1);" },
236
- { "monop", "cast_uint16", "uint64",
237
- "(#2) = (uint16_t)(#1);" },
238
- { "monop", "cast_int32", "uint64",
239
- "(#2) = (int32_t)(#1);" },
240
- { "monop", "cast_uint32", "uint64",
241
- "(#2) = (uint32_t)(#1);" },
242
- { "monop", "cast_int64", "uint64",
243
- "(#2) = (int64_t)(#1);" },
244
- { "monop", "cast_uint64", "uint64",
245
- "(#2) = (uint64_t)(#1);" },
246
- { "monop", "cast_float32", "uint64",
247
- "(#2) = (float)(double)(#1);" },
248
- { "monop", "cast_float64", "uint64",
249
- "(#2) = (double)(#1);" },
250
- { "monop", "cast_cmplx64", "uint64",
251
- "(#2) = (cmplx64_t)(double)(#1);" },
252
- { "monop", "cast_cmplx128", "uint64",
253
- "(#2) = (cmplx128_t)(#1);" },
254
- { "monop", "cast_float32", "float32",
255
- "(#2) = (float)(#1);" },
256
- { "monop", "cast_float64", "float32",
257
- "(#2) = (double)(#1);" },
258
- { "monop", "cast_cmplx64", "float32",
259
- "(#2) = (cmplx64_t)(#1);" },
260
- { "monop", "cast_cmplx128", "float32",
261
- "(#2) = (cmplx128_t)(#1);" },
262
- { "monop", "cast_float32", "float64",
263
- "(#2) = (float)(#1);" },
264
- { "monop", "cast_float64", "float64",
265
- "(#2) = (double)(#1);" },
266
- { "monop", "cast_cmplx64", "float64",
267
- "(#2) = (cmplx64_t)(#1);" },
268
- { "monop", "cast_cmplx128", "float64",
269
- "(#2) = (cmplx128_t)(#1);" },
270
- { "monop", "cast_float32", "cmplx64",
271
- "(#2) = (float)(#1);" },
272
- { "monop", "cast_float64", "cmplx64",
273
- "(#2) = (double)(#1);" },
274
- { "monop", "cast_cmplx64", "cmplx64",
275
- "(#2) = (cmplx64_t)(#1);" },
276
- { "monop", "cast_cmplx128", "cmplx64",
277
- "(#2) = (cmplx128_t)(#1);" },
278
- { "monop", "cast_float32", "cmplx128",
279
- "(#2) = (float)(#1);" },
280
- { "monop", "cast_float64", "cmplx128",
281
- "(#2) = (double)(#1);" },
282
- { "monop", "cast_cmplx64", "cmplx128",
283
- "(#2) = (cmplx64_t)(#1);" },
284
- { "monop", "cast_cmplx128", "cmplx128",
285
- "(#2) = (cmplx128_t)(#1);" },
286
- { "monop", "zero", "int8",
287
- "(#2) = 0;" },
288
- { "monop", "zero", "uint8",
289
- "(#2) = 0;" },
290
- { "monop", "zero", "int16",
291
- "(#2) = 0;" },
292
- { "monop", "zero", "uint16",
293
- "(#2) = 0;" },
294
- { "monop", "zero", "int32",
295
- "(#2) = 0;" },
296
- { "monop", "zero", "uint32",
297
- "(#2) = 0;" },
298
- { "monop", "zero", "int64",
299
- "(#2) = 0;" },
300
- { "monop", "zero", "uint64",
301
- "(#2) = 0;" },
302
- { "monop", "zero", "float32",
303
- "(#2) = 0;" },
304
- { "monop", "zero", "float64",
305
- "(#2) = 0;" },
306
- { "monop", "zero", "boolean",
307
- "(#2) = 0;" },
308
- { "monop", "zero", "cmplx64",
309
- "(#2) = 0.0;" },
310
- { "monop", "zero", "cmplx128",
311
- "(#2) = 0.0;" },
312
- { "monop", "one", "int8",
313
- "(#2) = 1;" },
314
- { "monop", "one", "uint8",
315
- "(#2) = 1;" },
316
- { "monop", "one", "int16",
317
- "(#2) = 1;" },
318
- { "monop", "one", "uint16",
319
- "(#2) = 1;" },
320
- { "monop", "one", "int32",
321
- "(#2) = 1;" },
322
- { "monop", "one", "uint32",
323
- "(#2) = 1;" },
324
- { "monop", "one", "int64",
325
- "(#2) = 1;" },
326
- { "monop", "one", "uint64",
327
- "(#2) = 1;" },
328
- { "monop", "one", "float32",
329
- "(#2) = 1;" },
330
- { "monop", "one", "float64",
331
- "(#2) = 1;" },
332
- { "monop", "one", "boolean",
333
- "(#2) = 1;" },
334
- { "monop", "one", "cmplx64",
335
- "(#2) = 1.0;" },
336
- { "monop", "one", "cmplx128",
337
- "(#2) = 1.0;" },
338
- { "monop", "frac", "int8",
339
- "(#2) = 0;" },
340
- { "monop", "frac", "uint8",
341
- "(#2) = 0;" },
342
- { "monop", "frac", "int16",
343
- "(#2) = 0;" },
344
- { "monop", "frac", "uint16",
345
- "(#2) = 0;" },
346
- { "monop", "frac", "int32",
347
- "(#2) = 0;" },
348
- { "monop", "frac", "uint32",
349
- "(#2) = 0;" },
350
- { "monop", "frac", "int64",
351
- "(#2) = 0;" },
352
- { "monop", "frac", "uint64",
353
- "(#2) = 0;" },
354
- { "monop", "frac", "float32",
355
- "(#2) = ((#1)>0.0) ? (#1)-floor(#1) : ((#1)<0.0) ? (#1)-ceil(#1) : (#1);" },
356
- { "monop", "frac", "float64",
357
- "(#2) = ((#1)>0.0) ? (#1)-floor(#1) : ((#1)<0.0) ? (#1)-ceil(#1) : (#1);" },
358
- { "monop", "neg", "int8",
359
- "(#2) = -(#1);" },
360
- { "monop", "neg", "uint8",
361
- "(#2) = -(#1);" },
362
- { "monop", "neg", "int16",
363
- "(#2) = -(#1);" },
364
- { "monop", "neg", "uint16",
365
- "(#2) = -(#1);" },
366
- { "monop", "neg", "int32",
367
- "(#2) = -(#1);" },
368
- { "monop", "neg", "uint32",
369
- "(#2) = -(#1);" },
370
- { "monop", "neg", "int64",
371
- "(#2) = -(#1);" },
372
- { "monop", "neg", "uint64",
373
- "(#2) = -(#1);" },
374
- { "monop", "neg", "float32",
375
- "(#2) = -(#1);" },
376
- { "monop", "neg", "float64",
377
- "(#2) = -(#1);" },
378
- { "monop", "neg", "cmplx64",
379
- "(#2) = -(#1);" },
380
- { "monop", "neg", "cmplx128",
381
- "(#2) = -(#1);" },
382
- { "monop", "bit_neg", "int8",
383
- "(#2) = ~(#1);" },
384
- { "monop", "bit_neg", "uint8",
385
- "(#2) = ~(#1);" },
386
- { "monop", "bit_neg", "int16",
387
- "(#2) = ~(#1);" },
388
- { "monop", "bit_neg", "uint16",
389
- "(#2) = ~(#1);" },
390
- { "monop", "bit_neg", "int32",
391
- "(#2) = ~(#1);" },
392
- { "monop", "bit_neg", "uint32",
393
- "(#2) = ~(#1);" },
394
- { "monop", "bit_neg", "int64",
395
- "(#2) = ~(#1);" },
396
- { "monop", "bit_neg", "uint64",
397
- "(#2) = ~(#1);" },
398
- { "monop", "bit_neg", "boolean",
399
- "(#2) = (#1) ? 0 : 1;" },
400
- { "monop", "abs_i", "int8",
401
- "(#2) = abs(#1);" },
402
- { "monop", "abs_i", "uint8",
403
- "(#2) = (#1);" },
404
- { "monop", "abs_i", "int16",
405
- "(#2) = abs(#1);" },
406
- { "monop", "abs_i", "uint16",
407
- "(#2) = (#1);" },
408
- { "monop", "abs_i", "int32",
409
- "(#2) = abs(#1);" },
410
- { "monop", "abs_i", "uint32",
411
- "(#2) = (#1);" },
412
- { "monop", "abs_i", "int64",
413
- "(#2) = llabs(#1);" },
414
- { "monop", "abs_i", "uint64",
415
- "(#2) = (#1);" },
416
- { "monop", "abs_i", "float32",
417
- "(#2) = fabs((float64_t)#1);" },
418
- { "monop", "abs_i", "float64",
419
- "(#2) = fabs((float64_t)#1);" },
420
- { "monop", "abs_i", "cmplx64",
421
- "(#2) = cabsf(#1);" },
422
- { "monop", "abs_i", "cmplx128",
423
- "(#2) = cabs(#1);" },
424
- { "monop", "abs", "int8",
425
- "(#2) = abs(#1);" },
426
- { "monop", "abs", "uint8",
427
- "(#2) = (#1);" },
428
- { "monop", "abs", "int16",
429
- "(#2) = abs(#1);" },
430
- { "monop", "abs", "uint16",
431
- "(#2) = (#1);" },
432
- { "monop", "abs", "int32",
433
- "(#2) = abs(#1);" },
434
- { "monop", "abs", "uint32",
435
- "(#2) = (#1);" },
436
- { "monop", "abs", "int64",
437
- "(#2) = llabs(#1);" },
438
- { "monop", "abs", "uint64",
439
- "(#2) = (#1);" },
440
- { "monop", "abs", "float32",
441
- "(#2) = fabs(#1);" },
442
- { "monop", "abs", "float64",
443
- "(#2) = fabs(#1);" },
444
- { "monop", "abs", "cmplx64",
445
- "(#2) = cabsf(#1);" },
446
- { "monop", "abs", "cmplx128",
447
- "(#2) = cabs(#1);" },
448
- { "monop", "abs2", "int8",
449
- "(#2) = (#1) * (#1);" },
450
- { "monop", "abs2", "uint8",
451
- "(#2) = (#1) * (#1);" },
452
- { "monop", "abs2", "int16",
453
- "(#2) = (#1) * (#1);" },
454
- { "monop", "abs2", "uint16",
455
- "(#2) = (#1) * (#1);" },
456
- { "monop", "abs2", "int32",
457
- "(#2) = (#1) * (#1);" },
458
- { "monop", "abs2", "uint32",
459
- "(#2) = (#1) * (#1);" },
460
- { "monop", "abs2", "int64",
461
- "(#2) = (#1) * (#1);" },
462
- { "monop", "abs2", "uint64",
463
- "(#2) = (#1) * (#1);" },
464
- { "monop", "abs2", "float32",
465
- "(#2) = (#1) * (#1);" },
466
- { "monop", "abs2", "float64",
467
- "(#2) = (#1) * (#1);" },
468
- { "monop", "abs2", "cmplx64",
469
- "{ float _r = crealf(#1); float _i = cimagf(#1); (#2) = _r * _r + _i * _i; }" },
470
- { "monop", "abs2", "cmplx128",
471
- "{ double _r = creal(#1); double _i = cimag(#1); (#2) = _r * _r + _i * _i; }" },
472
- { "monop", "conj", "int8",
473
- "(#2) = (#1);" },
474
- { "monop", "conj", "uint8",
475
- "(#2) = (#1);" },
476
- { "monop", "conj", "int16",
477
- "(#2) = (#1);" },
478
- { "monop", "conj", "uint16",
479
- "(#2) = (#1);" },
480
- { "monop", "conj", "int32",
481
- "(#2) = (#1);" },
482
- { "monop", "conj", "uint32",
483
- "(#2) = (#1);" },
484
- { "monop", "conj", "int64",
485
- "(#2) = (#1);" },
486
- { "monop", "conj", "uint64",
487
- "(#2) = (#1);" },
488
- { "monop", "conj", "float32",
489
- "(#2) = (#1);" },
490
- { "monop", "conj", "float64",
491
- "(#2) = (#1);" },
492
- { "monop", "conj", "cmplx64",
493
- "(#2) = conjf(#1);" },
494
- { "monop", "conj", "cmplx128",
495
- "(#2) = conj(#1);" },
496
- { "monop", "sign", "int8",
497
- "(#2) = ((#1) > 0) - ((#1) < 0);" },
498
- { "monop", "sign", "uint8",
499
- "(#2) = ((#1) > 0) ? 1 : 0;" },
500
- { "monop", "sign", "int16",
501
- "(#2) = ((#1) > 0) - ((#1) < 0);" },
502
- { "monop", "sign", "uint16",
503
- "(#2) = ((#1) > 0) ? 1 : 0;" },
504
- { "monop", "sign", "int32",
505
- "(#2) = ((#1) > 0) - ((#1) < 0);" },
506
- { "monop", "sign", "uint32",
507
- "(#2) = ((#1) > 0) ? 1 : 0;" },
508
- { "monop", "sign", "int64",
509
- "(#2) = ((#1) > 0) - ((#1) < 0);" },
510
- { "monop", "sign", "uint64",
511
- "(#2) = ((#1) > 0) ? 1 : 0;" },
512
- { "monop", "sign", "float32",
513
- "(#2) = isnan(#1) ? (#1) : (((#1) > 0) - ((#1) < 0));" },
514
- { "monop", "sign", "float64",
515
- "(#2) = isnan(#1) ? (#1) : (((#1) > 0) - ((#1) < 0));" },
516
- { "monop", "sign", "boolean",
517
- "(#2) = (#1) ? 1 : 0;" },
518
- { "monop", "sign", "cmplx64",
519
- "{ float _m = cabsf(#1); (#2) = (_m == 0) ? 0 : ((#1) / _m); }" },
520
- { "monop", "sign", "cmplx128",
521
- "{ double _m = cabs(#1); (#2) = (_m == 0) ? 0 : ((#1) / _m); }" },
522
- { "monop", "arg", "int8",
523
- "(#2) = carg((cmplx128_t)(#1));" },
524
- { "monop", "arg", "uint8",
525
- "(#2) = carg((cmplx128_t)(#1));" },
526
- { "monop", "arg", "int16",
527
- "(#2) = carg((cmplx128_t)(#1));" },
528
- { "monop", "arg", "uint16",
529
- "(#2) = carg((cmplx128_t)(#1));" },
530
- { "monop", "arg", "int32",
531
- "(#2) = carg((cmplx128_t)(#1));" },
532
- { "monop", "arg", "uint32",
533
- "(#2) = carg((cmplx128_t)(#1));" },
534
- { "monop", "arg", "int64",
535
- "(#2) = carg((cmplx128_t)(#1));" },
536
- { "monop", "arg", "uint64",
537
- "(#2) = carg((cmplx128_t)(#1));" },
538
- { "monop", "arg", "float32",
539
- "(#2) = carg((cmplx128_t)(#1));" },
540
- { "monop", "arg", "float64",
541
- "(#2) = carg((cmplx128_t)(#1));" },
542
- { "monop", "arg", "cmplx64",
543
- "(#2) = cargf(#1);" },
544
- { "monop", "arg", "cmplx128",
545
- "(#2) = carg(#1);" },
546
- { "monop", "imag_i", "int8",
547
- "(#2) = 0;" },
548
- { "monop", "imag_i", "uint8",
549
- "(#2) = 0;" },
550
- { "monop", "imag_i", "int16",
551
- "(#2) = 0;" },
552
- { "monop", "imag_i", "uint16",
553
- "(#2) = 0;" },
554
- { "monop", "imag_i", "int32",
555
- "(#2) = 0;" },
556
- { "monop", "imag_i", "uint32",
557
- "(#2) = 0;" },
558
- { "monop", "imag_i", "int64",
559
- "(#2) = 0;" },
560
- { "monop", "imag_i", "uint64",
561
- "(#2) = 0;" },
562
- { "monop", "imag_i", "float32",
563
- "(#2) = 0;" },
564
- { "monop", "imag_i", "float64",
565
- "(#2) = 0;" },
566
- { "monop", "imag_i", "cmplx64",
567
- "(#2) = cimagf(#1);" },
568
- { "monop", "imag_i", "cmplx128",
569
- "(#2) = cimag(#1);" },
570
- { "monop", "arg_i", "float32",
571
- "(#2) = carg((cmplx128_t)(#1));" },
572
- { "monop", "arg_i", "float64",
573
- "(#2) = carg((cmplx128_t)(#1));" },
574
- { "monop", "arg_i", "cmplx64",
575
- "(#2) = cargf(#1);" },
576
- { "monop", "arg_i", "cmplx128",
577
- "(#2) = carg(#1);" },
578
- { "monop", "not", "boolean",
579
- "(#2) = (#1) ? 0 : 1;" },
580
- { "monop", "rad", "float32",
581
- "(#2) = (0.0174532925199433*(#1));" },
582
- { "monop", "rad", "float64",
583
- "(#2) = (0.0174532925199433*(#1));" },
584
- { "monop", "deg", "float32",
585
- "(#2) = (57.2957795130823*(#1));" },
586
- { "monop", "deg", "float64",
587
- "(#2) = (57.2957795130823*(#1));" },
588
- { "monop", "ceil", "int8",
589
- "(#2) = (#1);" },
590
- { "monop", "ceil", "uint8",
591
- "(#2) = (#1);" },
592
- { "monop", "ceil", "int16",
593
- "(#2) = (#1);" },
594
- { "monop", "ceil", "uint16",
595
- "(#2) = (#1);" },
596
- { "monop", "ceil", "int32",
597
- "(#2) = (#1);" },
598
- { "monop", "ceil", "uint32",
599
- "(#2) = (#1);" },
600
- { "monop", "ceil", "int64",
601
- "(#2) = (#1);" },
602
- { "monop", "ceil", "uint64",
603
- "(#2) = (#1);" },
604
- { "monop", "ceil", "float32",
605
- "(#2) = ceil(#1);" },
606
- { "monop", "ceil", "float64",
607
- "(#2) = ceil(#1);" },
608
- { "monop", "floor", "int8",
609
- "(#2) = (#1);" },
610
- { "monop", "floor", "uint8",
611
- "(#2) = (#1);" },
612
- { "monop", "floor", "int16",
613
- "(#2) = (#1);" },
614
- { "monop", "floor", "uint16",
615
- "(#2) = (#1);" },
616
- { "monop", "floor", "int32",
617
- "(#2) = (#1);" },
618
- { "monop", "floor", "uint32",
619
- "(#2) = (#1);" },
620
- { "monop", "floor", "int64",
621
- "(#2) = (#1);" },
622
- { "monop", "floor", "uint64",
623
- "(#2) = (#1);" },
624
- { "monop", "floor", "float32",
625
- "(#2) = floor(#1);" },
626
- { "monop", "floor", "float64",
627
- "(#2) = floor(#1);" },
628
- { "monop", "round", "int8",
629
- "(#2) = (#1);" },
630
- { "monop", "round", "uint8",
631
- "(#2) = (#1);" },
632
- { "monop", "round", "int16",
633
- "(#2) = (#1);" },
634
- { "monop", "round", "uint16",
635
- "(#2) = (#1);" },
636
- { "monop", "round", "int32",
637
- "(#2) = (#1);" },
638
- { "monop", "round", "uint32",
639
- "(#2) = (#1);" },
640
- { "monop", "round", "int64",
641
- "(#2) = (#1);" },
642
- { "monop", "round", "uint64",
643
- "(#2) = (#1);" },
644
- { "monop", "round", "float32",
645
- "(#2) = round(#1);" },
646
- { "monop", "round", "float64",
647
- "(#2) = round(#1);" },
648
- { "monop", "rcp", "int8",
649
- "if ((#1)==0) {ca_zerodiv();}; (#2) = ((#1)==1) ? 1 : ((#1) < 0) ? -1 : 0;" },
650
- { "monop", "rcp", "uint8",
651
- "if ((#1)==0) {ca_zerodiv();}; (#2) = 1/(#1);" },
652
- { "monop", "rcp", "int16",
653
- "if ((#1)==0) {ca_zerodiv();}; (#2) = ((#1)==1) ? 1 : ((#1) < 0) ? -1 : 0;" },
654
- { "monop", "rcp", "uint16",
655
- "if ((#1)==0) {ca_zerodiv();}; (#2) = 1/(#1);" },
656
- { "monop", "rcp", "int32",
657
- "if ((#1)==0) {ca_zerodiv();}; (#2) = ((#1)==1) ? 1 : ((#1) < 0) ? -1 : 0;" },
658
- { "monop", "rcp", "uint32",
659
- "if ((#1)==0) {ca_zerodiv();}; (#2) = 1/(#1);" },
660
- { "monop", "rcp", "int64",
661
- "if ((#1)==0) {ca_zerodiv();}; (#2) = ((#1)==1) ? 1 : ((#1) < 0) ? -1 : 0;" },
662
- { "monop", "rcp", "uint64",
663
- "if ((#1)==0) {ca_zerodiv();}; (#2) = 1/(#1);" },
664
- { "monop", "rcp", "float32",
665
- "(#2) = 1/(#1);" },
666
- { "monop", "rcp", "float64",
667
- "(#2) = 1/(#1);" },
668
- { "monop", "rcp", "cmplx64",
669
- "(#2) = op_crcp_cmplx64(#1);" },
670
- { "monop", "rcp", "cmplx128",
671
- "(#2) = 1/(#1);" },
672
- { "monop", "sqrt", "float32",
673
- "(#2) = sqrtf(#1);" },
674
- { "monop", "sqrt", "float64",
675
- "(#2) = sqrt(#1);" },
676
- { "monop", "sqrt", "cmplx64",
677
- "(#2) = csqrtf(#1);" },
678
- { "monop", "sqrt", "cmplx128",
679
- "(#2) = csqrt(#1);" },
680
- { "monop", "exp", "float32",
681
- "(#2) = expf(#1);" },
682
- { "monop", "exp", "float64",
683
- "(#2) = exp(#1);" },
684
- { "monop", "exp", "cmplx64",
685
- "(#2) = cexpf(#1);" },
686
- { "monop", "exp", "cmplx128",
687
- "(#2) = cexp(#1);" },
688
- { "monop", "sin", "float32",
689
- "(#2) = sinf(#1);" },
690
- { "monop", "sin", "float64",
691
- "(#2) = sin(#1);" },
692
- { "monop", "sin", "cmplx64",
693
- "(#2) = csinf(#1);" },
694
- { "monop", "sin", "cmplx128",
695
- "(#2) = csin(#1);" },
696
- { "monop", "cos", "float32",
697
- "(#2) = cosf(#1);" },
698
- { "monop", "cos", "float64",
699
- "(#2) = cos(#1);" },
700
- { "monop", "cos", "cmplx64",
701
- "(#2) = ccosf(#1);" },
702
- { "monop", "cos", "cmplx128",
703
- "(#2) = ccos(#1);" },
704
- { "monop", "tan", "float32",
705
- "(#2) = tanf(#1);" },
706
- { "monop", "tan", "float64",
707
- "(#2) = tan(#1);" },
708
- { "monop", "tan", "cmplx64",
709
- "(#2) = ctanf(#1);" },
710
- { "monop", "tan", "cmplx128",
711
- "(#2) = ctan(#1);" },
712
- { "monop", "asin", "float32",
713
- "(#2) = asinf(#1);" },
714
- { "monop", "asin", "float64",
715
- "(#2) = asin(#1);" },
716
- { "monop", "asin", "cmplx64",
717
- "(#2) = casinf(#1);" },
718
- { "monop", "asin", "cmplx128",
719
- "(#2) = casin(#1);" },
720
- { "monop", "acos", "float32",
721
- "(#2) = acosf(#1);" },
722
- { "monop", "acos", "float64",
723
- "(#2) = acos(#1);" },
724
- { "monop", "acos", "cmplx64",
725
- "(#2) = cacosf(#1);" },
726
- { "monop", "acos", "cmplx128",
727
- "(#2) = cacos(#1);" },
728
- { "monop", "atan", "float32",
729
- "(#2) = atanf(#1);" },
730
- { "monop", "atan", "float64",
731
- "(#2) = atan(#1);" },
732
- { "monop", "atan", "cmplx64",
733
- "(#2) = catanf(#1);" },
734
- { "monop", "atan", "cmplx128",
735
- "(#2) = catan(#1);" },
736
- { "monop", "log", "float32",
737
- "(#2) = logf(#1);" },
738
- { "monop", "log", "float64",
739
- "(#2) = log(#1);" },
740
- { "monop", "log", "cmplx64",
741
- "(#2) = clog(#1);" },
742
- { "monop", "log", "cmplx128",
743
- "(#2) = clog(#1);" },
744
- { "monop", "exp2", "float32",
745
- "(#2) = exp2f(#1);" },
746
- { "monop", "exp2", "float64",
747
- "(#2) = exp2(#1);" },
748
- { "monop", "exp2", "cmplx64",
749
- "(#2) = cpow(2, (#1));" },
750
- { "monop", "exp2", "cmplx128",
751
- "(#2) = cpow(2, (#1));" },
752
- { "monop", "log10", "float32",
753
- "(#2) = log10f(#1);" },
754
- { "monop", "log10", "float64",
755
- "(#2) = log10(#1);" },
756
- { "monop", "log2", "float32",
757
- "(#2) = log2f(#1);" },
758
- { "monop", "log2", "float64",
759
- "(#2) = log2(#1);" },
760
- { "monop", "logb", "float32",
761
- "(#2) = logbf(#1);" },
762
- { "monop", "logb", "float64",
763
- "(#2) = logb(#1);" },
764
- { "monop", "exp10", "float32",
765
- "(#2) = powf(10, (#1));" },
766
- { "monop", "exp10", "float64",
767
- "(#2) = pow(10, (#1));" },
768
- { "monop", "exp10", "cmplx64",
769
- "(#2) = cpow(10, (#1));" },
770
- { "monop", "exp10", "cmplx128",
771
- "(#2) = cpow(10, (#1));" },
772
- { "monop", "sinh", "float32",
773
- "(#2) = sinhf(#1);" },
774
- { "monop", "sinh", "float64",
775
- "(#2) = sinh(#1);" },
776
- { "monop", "sinh", "cmplx64",
777
- "(#2) = csinhf(#1);" },
778
- { "monop", "sinh", "cmplx128",
779
- "(#2) = csinh(#1);" },
780
- { "monop", "cosh", "float32",
781
- "(#2) = coshf(#1);" },
782
- { "monop", "cosh", "float64",
783
- "(#2) = cosh(#1);" },
784
- { "monop", "cosh", "cmplx64",
785
- "(#2) = ccoshf(#1);" },
786
- { "monop", "cosh", "cmplx128",
787
- "(#2) = ccosh(#1);" },
788
- { "monop", "tanh", "float32",
789
- "(#2) = tanhf(#1);" },
790
- { "monop", "tanh", "float64",
791
- "(#2) = tanh(#1);" },
792
- { "monop", "tanh", "cmplx64",
793
- "(#2) = ctanhf(#1);" },
794
- { "monop", "tanh", "cmplx128",
795
- "(#2) = ctanh(#1);" },
796
- { "monop", "asinh", "float32",
797
- "(#2) = asinhf(#1);" },
798
- { "monop", "asinh", "float64",
799
- "(#2) = asinh(#1);" },
800
- { "monop", "asinh", "cmplx64",
801
- "(#2) = casinhf(#1);" },
802
- { "monop", "asinh", "cmplx128",
803
- "(#2) = casinh(#1);" },
804
- { "monop", "acosh", "float32",
805
- "(#2) = acoshf(#1);" },
806
- { "monop", "acosh", "float64",
807
- "(#2) = acosh(#1);" },
808
- { "monop", "acosh", "cmplx64",
809
- "(#2) = cacoshf(#1);" },
810
- { "monop", "acosh", "cmplx128",
811
- "(#2) = cacosh(#1);" },
812
- { "monop", "atanh", "float32",
813
- "(#2) = atanhf(#1);" },
814
- { "monop", "atanh", "float64",
815
- "(#2) = atanh(#1);" },
816
- { "monop", "atanh", "cmplx64",
817
- "(#2) = catanhf(#1);" },
818
- { "monop", "atanh", "cmplx128",
819
- "(#2) = catanh(#1);" },
820
- { "monop", "expm1", "float32",
821
- "(#2) = expm1f(#1);" },
822
- { "monop", "expm1", "float64",
823
- "(#2) = expm1(#1);" },
824
- { "monop", "log1p", "float32",
825
- "(#2) = log1pf(#1);" },
826
- { "monop", "log1p", "float64",
827
- "(#2) = log1p(#1);" },
828
- { "monop", "rsqrt", "float32",
829
- "(#2) = ((float)1.0) / sqrtf(#1);" },
830
- { "monop", "rsqrt", "float64",
831
- "(#2) = ((double)1.0) / sqrt(#1);" },
832
- { "monop", "rsqrt", "cmplx64",
833
- "(#2) = ((float)1.0) / csqrtf(#1);" },
834
- { "monop", "rsqrt", "cmplx128",
835
- "(#2) = ((double)1.0) / csqrt(#1);" },
836
- { "monop", "trunc", "int8",
837
- "(#2) = (#1);" },
838
- { "monop", "trunc", "uint8",
839
- "(#2) = (#1);" },
840
- { "monop", "trunc", "int16",
841
- "(#2) = (#1);" },
842
- { "monop", "trunc", "uint16",
843
- "(#2) = (#1);" },
844
- { "monop", "trunc", "int32",
845
- "(#2) = (#1);" },
846
- { "monop", "trunc", "uint32",
847
- "(#2) = (#1);" },
848
- { "monop", "trunc", "int64",
849
- "(#2) = (#1);" },
850
- { "monop", "trunc", "uint64",
851
- "(#2) = (#1);" },
852
- { "monop", "trunc", "float32",
853
- "(#2) = trunc(#1);" },
854
- { "monop", "trunc", "float64",
855
- "(#2) = trunc(#1);" },
856
- { "monop", "square", "int8",
857
- "(#2) = (#1) * (#1);" },
858
- { "monop", "square", "uint8",
859
- "(#2) = (#1) * (#1);" },
860
- { "monop", "square", "int16",
861
- "(#2) = (#1) * (#1);" },
862
- { "monop", "square", "uint16",
863
- "(#2) = (#1) * (#1);" },
864
- { "monop", "square", "int32",
865
- "(#2) = (#1) * (#1);" },
866
- { "monop", "square", "uint32",
867
- "(#2) = (#1) * (#1);" },
868
- { "monop", "square", "int64",
869
- "(#2) = (#1) * (#1);" },
870
- { "monop", "square", "uint64",
871
- "(#2) = (#1) * (#1);" },
872
- { "monop", "square", "float32",
873
- "(#2) = (#1) * (#1);" },
874
- { "monop", "square", "float64",
875
- "(#2) = (#1) * (#1);" },
876
- { "monop", "square", "cmplx64",
877
- "(#2) = (#1) * (#1);" },
878
- { "monop", "square", "cmplx128",
879
- "(#2) = (#1) * (#1);" },
880
- { "monop", "deg_360", "float32",
881
- "{\n double _fa = (double)(#1) / 360.0;\n (#2) = (_fa - floor(_fa)) * 360.0;\n if ( (#2) >= 360.0 ) (#2) = 0.0; /* a tiny negative rounds to the top */\n}\n" },
882
- { "monop", "deg_360", "float64",
883
- "{\n double _fa = (double)(#1) / 360.0;\n (#2) = (_fa - floor(_fa)) * 360.0;\n if ( (#2) >= 360.0 ) (#2) = 0.0; /* a tiny negative rounds to the top */\n}\n" },
884
- { "monop", "deg_180", "float32",
885
- "{\n double _a = (double)(#1);\n double _fa = (_a + 180.0) / 360.0;\n double _b = (_a >= 0)\n ? (_fa - floor(_fa)) * 360.0 - 180.0\n : (_fa - ceil(_fa)) * 360.0 - 180.0;\n if (_b <= -180.0) _b += 360.0;\n (#2) = _b;\n}\n" },
886
- { "monop", "deg_180", "float64",
887
- "{\n double _a = (double)(#1);\n double _fa = (_a + 180.0) / 360.0;\n double _b = (_a >= 0)\n ? (_fa - floor(_fa)) * 360.0 - 180.0\n : (_fa - ceil(_fa)) * 360.0 - 180.0;\n if (_b <= -180.0) _b += 360.0;\n (#2) = _b;\n}\n" },
888
- { "monop", "rad_2pi", "float32",
889
- "{\n double _two_pi = 2.0 * M_PI;\n double _fa = (double)(#1) / _two_pi;\n (#2) = (_fa - floor(_fa)) * _two_pi;\n if ( (#2) >= _two_pi ) (#2) = 0.0; /* a tiny negative rounds to the top */\n}\n" },
890
- { "monop", "rad_2pi", "float64",
891
- "{\n double _two_pi = 2.0 * M_PI;\n double _fa = (double)(#1) / _two_pi;\n (#2) = (_fa - floor(_fa)) * _two_pi;\n if ( (#2) >= _two_pi ) (#2) = 0.0; /* a tiny negative rounds to the top */\n}\n" },
892
- { "monop", "rad_pi", "float32",
893
- "{\n double _two_pi = 2.0 * M_PI;\n double _a = (double)(#1);\n double _fa = (_a + M_PI) / _two_pi;\n double _b = (_a >= 0)\n ? (_fa - floor(_fa)) * _two_pi - M_PI\n : (_fa - ceil(_fa)) * _two_pi - M_PI;\n if (_b <= -M_PI) _b += _two_pi;\n (#2) = _b;\n}\n" },
894
- { "monop", "rad_pi", "float64",
895
- "{\n double _two_pi = 2.0 * M_PI;\n double _a = (double)(#1);\n double _fa = (_a + M_PI) / _two_pi;\n double _b = (_a >= 0)\n ? (_fa - floor(_fa)) * _two_pi - M_PI\n : (_fa - ceil(_fa)) * _two_pi - M_PI;\n if (_b <= -M_PI) _b += _two_pi;\n (#2) = _b;\n}\n" },
896
- { "binop", "pmax", "int8",
897
- "(#3) = (#1) > (#2) ? (#1) : (#2);" },
898
- { "binop", "pmax", "uint8",
899
- "(#3) = (#1) > (#2) ? (#1) : (#2);" },
900
- { "binop", "pmax", "int16",
901
- "(#3) = (#1) > (#2) ? (#1) : (#2);" },
902
- { "binop", "pmax", "uint16",
903
- "(#3) = (#1) > (#2) ? (#1) : (#2);" },
904
- { "binop", "pmax", "int32",
905
- "(#3) = (#1) > (#2) ? (#1) : (#2);" },
906
- { "binop", "pmax", "uint32",
907
- "(#3) = (#1) > (#2) ? (#1) : (#2);" },
908
- { "binop", "pmax", "int64",
909
- "(#3) = (#1) > (#2) ? (#1) : (#2);" },
910
- { "binop", "pmax", "uint64",
911
- "(#3) = (#1) > (#2) ? (#1) : (#2);" },
912
- { "binop", "pmax", "float32",
913
- "(#3) = isnan(#1) ? (#2) : isnan(#2) ? (#1) : ((#1) > (#2) || ((#1) == (#2) && copysignf(1, (#1)) > 0)) ? (#1) : (#2);" },
914
- { "binop", "pmax", "float64",
915
- "(#3) = isnan(#1) ? (#2) : isnan(#2) ? (#1) : ((#1) > (#2) || ((#1) == (#2) && copysign(1, (#1)) > 0)) ? (#1) : (#2);" },
916
- { "binop", "pmin", "int8",
917
- "(#3) = (#1) < (#2) ? (#1) : (#2);" },
918
- { "binop", "pmin", "uint8",
919
- "(#3) = (#1) < (#2) ? (#1) : (#2);" },
920
- { "binop", "pmin", "int16",
921
- "(#3) = (#1) < (#2) ? (#1) : (#2);" },
922
- { "binop", "pmin", "uint16",
923
- "(#3) = (#1) < (#2) ? (#1) : (#2);" },
924
- { "binop", "pmin", "int32",
925
- "(#3) = (#1) < (#2) ? (#1) : (#2);" },
926
- { "binop", "pmin", "uint32",
927
- "(#3) = (#1) < (#2) ? (#1) : (#2);" },
928
- { "binop", "pmin", "int64",
929
- "(#3) = (#1) < (#2) ? (#1) : (#2);" },
930
- { "binop", "pmin", "uint64",
931
- "(#3) = (#1) < (#2) ? (#1) : (#2);" },
932
- { "binop", "pmin", "float32",
933
- "(#3) = isnan(#1) ? (#2) : isnan(#2) ? (#1) : ((#1) < (#2) || ((#1) == (#2) && copysignf(1, (#1)) < 0)) ? (#1) : (#2);" },
934
- { "binop", "pmin", "float64",
935
- "(#3) = isnan(#1) ? (#2) : isnan(#2) ? (#1) : ((#1) < (#2) || ((#1) == (#2) && copysign(1, (#1)) < 0)) ? (#1) : (#2);" },
936
- { "binop", "maximum", "int8",
937
- "(#3) = (#1) > (#2) ? (#1) : (#2);" },
938
- { "binop", "maximum", "uint8",
939
- "(#3) = (#1) > (#2) ? (#1) : (#2);" },
940
- { "binop", "maximum", "int16",
941
- "(#3) = (#1) > (#2) ? (#1) : (#2);" },
942
- { "binop", "maximum", "uint16",
943
- "(#3) = (#1) > (#2) ? (#1) : (#2);" },
944
- { "binop", "maximum", "int32",
945
- "(#3) = (#1) > (#2) ? (#1) : (#2);" },
946
- { "binop", "maximum", "uint32",
947
- "(#3) = (#1) > (#2) ? (#1) : (#2);" },
948
- { "binop", "maximum", "int64",
949
- "(#3) = (#1) > (#2) ? (#1) : (#2);" },
950
- { "binop", "maximum", "uint64",
951
- "(#3) = (#1) > (#2) ? (#1) : (#2);" },
952
- { "binop", "maximum", "float32",
953
- "(#3) = isnan(#1) ? (#1) : isnan(#2) ? (#2) : ((#1) > (#2) || ((#1) == (#2) && copysignf(1, (#1)) > 0)) ? (#1) : (#2);" },
954
- { "binop", "maximum", "float64",
955
- "(#3) = isnan(#1) ? (#1) : isnan(#2) ? (#2) : ((#1) > (#2) || ((#1) == (#2) && copysign(1, (#1)) > 0)) ? (#1) : (#2);" },
956
- { "binop", "minimum", "int8",
957
- "(#3) = (#1) < (#2) ? (#1) : (#2);" },
958
- { "binop", "minimum", "uint8",
959
- "(#3) = (#1) < (#2) ? (#1) : (#2);" },
960
- { "binop", "minimum", "int16",
961
- "(#3) = (#1) < (#2) ? (#1) : (#2);" },
962
- { "binop", "minimum", "uint16",
963
- "(#3) = (#1) < (#2) ? (#1) : (#2);" },
964
- { "binop", "minimum", "int32",
965
- "(#3) = (#1) < (#2) ? (#1) : (#2);" },
966
- { "binop", "minimum", "uint32",
967
- "(#3) = (#1) < (#2) ? (#1) : (#2);" },
968
- { "binop", "minimum", "int64",
969
- "(#3) = (#1) < (#2) ? (#1) : (#2);" },
970
- { "binop", "minimum", "uint64",
971
- "(#3) = (#1) < (#2) ? (#1) : (#2);" },
972
- { "binop", "minimum", "float32",
973
- "(#3) = isnan(#1) ? (#1) : isnan(#2) ? (#2) : ((#1) < (#2) || ((#1) == (#2) && copysignf(1, (#1)) < 0)) ? (#1) : (#2);" },
974
- { "binop", "minimum", "float64",
975
- "(#3) = isnan(#1) ? (#1) : isnan(#2) ? (#2) : ((#1) < (#2) || ((#1) == (#2) && copysign(1, (#1)) < 0)) ? (#1) : (#2);" },
976
- { "binop", "add", "int8",
977
- "(#3) = (#1) + (#2);" },
978
- { "binop", "add", "uint8",
979
- "(#3) = (#1) + (#2);" },
980
- { "binop", "add", "int16",
981
- "(#3) = (#1) + (#2);" },
982
- { "binop", "add", "uint16",
983
- "(#3) = (#1) + (#2);" },
984
- { "binop", "add", "int32",
985
- "(#3) = (#1) + (#2);" },
986
- { "binop", "add", "uint32",
987
- "(#3) = (#1) + (#2);" },
988
- { "binop", "add", "int64",
989
- "(#3) = (#1) + (#2);" },
990
- { "binop", "add", "uint64",
991
- "(#3) = (#1) + (#2);" },
992
- { "binop", "add", "float32",
993
- "(#3) = (#1) + (#2);" },
994
- { "binop", "add", "float64",
995
- "(#3) = (#1) + (#2);" },
996
- { "binop", "add", "cmplx64",
997
- "(#3) = (#1) + (#2);" },
998
- { "binop", "add", "cmplx128",
999
- "(#3) = (#1) + (#2);" },
1000
- { "binop", "sub", "int8",
1001
- "(#3) = (#1) - (#2);" },
1002
- { "binop", "sub", "uint8",
1003
- "(#3) = (#1) - (#2);" },
1004
- { "binop", "sub", "int16",
1005
- "(#3) = (#1) - (#2);" },
1006
- { "binop", "sub", "uint16",
1007
- "(#3) = (#1) - (#2);" },
1008
- { "binop", "sub", "int32",
1009
- "(#3) = (#1) - (#2);" },
1010
- { "binop", "sub", "uint32",
1011
- "(#3) = (#1) - (#2);" },
1012
- { "binop", "sub", "int64",
1013
- "(#3) = (#1) - (#2);" },
1014
- { "binop", "sub", "uint64",
1015
- "(#3) = (#1) - (#2);" },
1016
- { "binop", "sub", "float32",
1017
- "(#3) = (#1) - (#2);" },
1018
- { "binop", "sub", "float64",
1019
- "(#3) = (#1) - (#2);" },
1020
- { "binop", "sub", "cmplx64",
1021
- "(#3) = (#1) - (#2);" },
1022
- { "binop", "sub", "cmplx128",
1023
- "(#3) = (#1) - (#2);" },
1024
- { "binop", "mul", "int8",
1025
- "(#3) = (#1) * (#2);" },
1026
- { "binop", "mul", "uint8",
1027
- "(#3) = (#1) * (#2);" },
1028
- { "binop", "mul", "int16",
1029
- "(#3) = (#1) * (#2);" },
1030
- { "binop", "mul", "uint16",
1031
- "(#3) = (#1) * (#2);" },
1032
- { "binop", "mul", "int32",
1033
- "(#3) = (#1) * (#2);" },
1034
- { "binop", "mul", "uint32",
1035
- "(#3) = (#1) * (#2);" },
1036
- { "binop", "mul", "int64",
1037
- "(#3) = (#1) * (#2);" },
1038
- { "binop", "mul", "uint64",
1039
- "(#3) = (#1) * (#2);" },
1040
- { "binop", "mul", "float32",
1041
- "(#3) = (#1) * (#2);" },
1042
- { "binop", "mul", "float64",
1043
- "(#3) = (#1) * (#2);" },
1044
- { "binop", "mul", "cmplx64",
1045
- "(#3) = op_cmul_cmplx64((#1), (#2));" },
1046
- { "binop", "mul", "cmplx128",
1047
- "(#3) = (#1) * (#2);" },
1048
- { "binop", "div", "int8",
1049
- "\n if ((#2)==0) {ca_zerodiv();};\n if ((#2)==-1) { (#3) = (<type>) (0 - (uint64_t) (#1)); }\n else {\n <type> _q = (#1) / (#2);\n if ( (#1) % (#2) != 0 && (((#1) < 0) != ((#2) < 0)) ) { _q -= 1; }\n (#3) = _q;\n }\n " },
1050
- { "binop", "div", "uint8",
1051
- "if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) / (#2);" },
1052
- { "binop", "div", "int16",
1053
- "\n if ((#2)==0) {ca_zerodiv();};\n if ((#2)==-1) { (#3) = (<type>) (0 - (uint64_t) (#1)); }\n else {\n <type> _q = (#1) / (#2);\n if ( (#1) % (#2) != 0 && (((#1) < 0) != ((#2) < 0)) ) { _q -= 1; }\n (#3) = _q;\n }\n " },
1054
- { "binop", "div", "uint16",
1055
- "if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) / (#2);" },
1056
- { "binop", "div", "int32",
1057
- "\n if ((#2)==0) {ca_zerodiv();};\n if ((#2)==-1) { (#3) = (<type>) (0 - (uint64_t) (#1)); }\n else {\n <type> _q = (#1) / (#2);\n if ( (#1) % (#2) != 0 && (((#1) < 0) != ((#2) < 0)) ) { _q -= 1; }\n (#3) = _q;\n }\n " },
1058
- { "binop", "div", "uint32",
1059
- "if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) / (#2);" },
1060
- { "binop", "div", "int64",
1061
- "\n if ((#2)==0) {ca_zerodiv();};\n if ((#2)==-1) { (#3) = (<type>) (0 - (uint64_t) (#1)); }\n else {\n <type> _q = (#1) / (#2);\n if ( (#1) % (#2) != 0 && (((#1) < 0) != ((#2) < 0)) ) { _q -= 1; }\n (#3) = _q;\n }\n " },
1062
- { "binop", "div", "uint64",
1063
- "if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) / (#2);" },
1064
- { "binop", "div", "float32",
1065
- "(#3) = (#1) / (#2);" },
1066
- { "binop", "div", "float64",
1067
- "(#3) = (#1) / (#2);" },
1068
- { "binop", "div", "cmplx64",
1069
- "(#3) = op_cdiv_cmplx64((#1), (#2));" },
1070
- { "binop", "div", "cmplx128",
1071
- "(#3) = (#1) / (#2);" },
1072
- { "binop", "rcp_mul", "int8",
1073
- "\n if ((#1)==0) {ca_zerodiv();};\n if ((#1)==-1) { (#3) = (<type>) (0 - (uint64_t) (#2)); }\n else {\n <type> _q = (#2) / (#1);\n if ( (#2) % (#1) != 0 && (((#2) < 0) != ((#1) < 0)) ) { _q -= 1; }\n (#3) = _q;\n }\n " },
1074
- { "binop", "rcp_mul", "uint8",
1075
- "if ((#1)==0) {ca_zerodiv();}; (#3) = (#2) / (#1);" },
1076
- { "binop", "rcp_mul", "int16",
1077
- "\n if ((#1)==0) {ca_zerodiv();};\n if ((#1)==-1) { (#3) = (<type>) (0 - (uint64_t) (#2)); }\n else {\n <type> _q = (#2) / (#1);\n if ( (#2) % (#1) != 0 && (((#2) < 0) != ((#1) < 0)) ) { _q -= 1; }\n (#3) = _q;\n }\n " },
1078
- { "binop", "rcp_mul", "uint16",
1079
- "if ((#1)==0) {ca_zerodiv();}; (#3) = (#2) / (#1);" },
1080
- { "binop", "rcp_mul", "int32",
1081
- "\n if ((#1)==0) {ca_zerodiv();};\n if ((#1)==-1) { (#3) = (<type>) (0 - (uint64_t) (#2)); }\n else {\n <type> _q = (#2) / (#1);\n if ( (#2) % (#1) != 0 && (((#2) < 0) != ((#1) < 0)) ) { _q -= 1; }\n (#3) = _q;\n }\n " },
1082
- { "binop", "rcp_mul", "uint32",
1083
- "if ((#1)==0) {ca_zerodiv();}; (#3) = (#2) / (#1);" },
1084
- { "binop", "rcp_mul", "int64",
1085
- "\n if ((#1)==0) {ca_zerodiv();};\n if ((#1)==-1) { (#3) = (<type>) (0 - (uint64_t) (#2)); }\n else {\n <type> _q = (#2) / (#1);\n if ( (#2) % (#1) != 0 && (((#2) < 0) != ((#1) < 0)) ) { _q -= 1; }\n (#3) = _q;\n }\n " },
1086
- { "binop", "rcp_mul", "uint64",
1087
- "if ((#1)==0) {ca_zerodiv();}; (#3) = (#2) / (#1);" },
1088
- { "binop", "rcp_mul", "float32",
1089
- "(#3) = (#2) / (#1);" },
1090
- { "binop", "rcp_mul", "float64",
1091
- "(#3) = (#2) / (#1);" },
1092
- { "binop", "rcp_mul", "cmplx64",
1093
- "(#3) = op_cdiv_cmplx64((#2), (#1));" },
1094
- { "binop", "rcp_mul", "cmplx128",
1095
- "(#3) = (#2) / (#1);" },
1096
- { "binop", "mod", "int8",
1097
- "\n if ((#2)==0) {ca_zerodiv();};\n if ((#2)==-1) { (#3) = 0; }\n else {\n <type> _r = (#1) % (#2);\n if ( _r != 0 && ((_r < 0) != ((#2) < 0)) ) { _r += (#2); }\n (#3) = _r;\n }\n " },
1098
- { "binop", "mod", "uint8",
1099
- "if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) % (#2);" },
1100
- { "binop", "mod", "int16",
1101
- "\n if ((#2)==0) {ca_zerodiv();};\n if ((#2)==-1) { (#3) = 0; }\n else {\n <type> _r = (#1) % (#2);\n if ( _r != 0 && ((_r < 0) != ((#2) < 0)) ) { _r += (#2); }\n (#3) = _r;\n }\n " },
1102
- { "binop", "mod", "uint16",
1103
- "if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) % (#2);" },
1104
- { "binop", "mod", "int32",
1105
- "\n if ((#2)==0) {ca_zerodiv();};\n if ((#2)==-1) { (#3) = 0; }\n else {\n <type> _r = (#1) % (#2);\n if ( _r != 0 && ((_r < 0) != ((#2) < 0)) ) { _r += (#2); }\n (#3) = _r;\n }\n " },
1106
- { "binop", "mod", "uint32",
1107
- "if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) % (#2);" },
1108
- { "binop", "mod", "int64",
1109
- "\n if ((#2)==0) {ca_zerodiv();};\n if ((#2)==-1) { (#3) = 0; }\n else {\n <type> _r = (#1) % (#2);\n if ( _r != 0 && ((_r < 0) != ((#2) < 0)) ) { _r += (#2); }\n (#3) = _r;\n }\n " },
1110
- { "binop", "mod", "uint64",
1111
- "if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) % (#2);" },
1112
- { "binop", "mod", "float32",
1113
- "\n {\n <type> _r = fmod((#1), (#2));\n if ( _r != 0 ) {\n if ( (_r < 0) != ((#2) < 0) ) { _r += (#2); }\n }\n else { _r = copysign((<type>) 0, (#2)); }\n (#3) = _r;\n }\n " },
1114
- { "binop", "mod", "float64",
1115
- "\n {\n <type> _r = fmod((#1), (#2));\n if ( _r != 0 ) {\n if ( (_r < 0) != ((#2) < 0) ) { _r += (#2); }\n }\n else { _r = copysign((<type>) 0, (#2)); }\n (#3) = _r;\n }\n " },
1116
- { "binop", "fmod", "int8",
1117
- "if ((#2)==0) {ca_zerodiv();}; (#3) = ((#2)==-1) ? 0 : (#1) % (#2);" },
1118
- { "binop", "fmod", "uint8",
1119
- "if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) % (#2);" },
1120
- { "binop", "fmod", "int16",
1121
- "if ((#2)==0) {ca_zerodiv();}; (#3) = ((#2)==-1) ? 0 : (#1) % (#2);" },
1122
- { "binop", "fmod", "uint16",
1123
- "if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) % (#2);" },
1124
- { "binop", "fmod", "int32",
1125
- "if ((#2)==0) {ca_zerodiv();}; (#3) = ((#2)==-1) ? 0 : (#1) % (#2);" },
1126
- { "binop", "fmod", "uint32",
1127
- "if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) % (#2);" },
1128
- { "binop", "fmod", "int64",
1129
- "if ((#2)==0) {ca_zerodiv();}; (#3) = ((#2)==-1) ? 0 : (#1) % (#2);" },
1130
- { "binop", "fmod", "uint64",
1131
- "if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) % (#2);" },
1132
- { "binop", "fmod", "float32",
1133
- "(#3) = fmodf((#1), (#2));" },
1134
- { "binop", "fmod", "float64",
1135
- "(#3) = fmod((#1), (#2));" },
1136
- { "binop", "bit_and_i", "int8",
1137
- "(#3) = (#1) & (#2);" },
1138
- { "binop", "bit_and_i", "uint8",
1139
- "(#3) = (#1) & (#2);" },
1140
- { "binop", "bit_and_i", "int16",
1141
- "(#3) = (#1) & (#2);" },
1142
- { "binop", "bit_and_i", "uint16",
1143
- "(#3) = (#1) & (#2);" },
1144
- { "binop", "bit_and_i", "int32",
1145
- "(#3) = (#1) & (#2);" },
1146
- { "binop", "bit_and_i", "uint32",
1147
- "(#3) = (#1) & (#2);" },
1148
- { "binop", "bit_and_i", "int64",
1149
- "(#3) = (#1) & (#2);" },
1150
- { "binop", "bit_and_i", "uint64",
1151
- "(#3) = (#1) & (#2);" },
1152
- { "binop", "bit_and_i", "boolean",
1153
- "(#3) = (#1) & (#2);" },
1154
- { "binop", "bit_or_i", "int8",
1155
- "(#3) = (#1) | (#2);" },
1156
- { "binop", "bit_or_i", "uint8",
1157
- "(#3) = (#1) | (#2);" },
1158
- { "binop", "bit_or_i", "int16",
1159
- "(#3) = (#1) | (#2);" },
1160
- { "binop", "bit_or_i", "uint16",
1161
- "(#3) = (#1) | (#2);" },
1162
- { "binop", "bit_or_i", "int32",
1163
- "(#3) = (#1) | (#2);" },
1164
- { "binop", "bit_or_i", "uint32",
1165
- "(#3) = (#1) | (#2);" },
1166
- { "binop", "bit_or_i", "int64",
1167
- "(#3) = (#1) | (#2);" },
1168
- { "binop", "bit_or_i", "uint64",
1169
- "(#3) = (#1) | (#2);" },
1170
- { "binop", "bit_or_i", "boolean",
1171
- "(#3) = ((#1) | (#2)) ? 1 : 0;" },
1172
- { "binop", "bit_xor_i", "int8",
1173
- "(#3) = (#1) ^ (#2);" },
1174
- { "binop", "bit_xor_i", "uint8",
1175
- "(#3) = (#1) ^ (#2);" },
1176
- { "binop", "bit_xor_i", "int16",
1177
- "(#3) = (#1) ^ (#2);" },
1178
- { "binop", "bit_xor_i", "uint16",
1179
- "(#3) = (#1) ^ (#2);" },
1180
- { "binop", "bit_xor_i", "int32",
1181
- "(#3) = (#1) ^ (#2);" },
1182
- { "binop", "bit_xor_i", "uint32",
1183
- "(#3) = (#1) ^ (#2);" },
1184
- { "binop", "bit_xor_i", "int64",
1185
- "(#3) = (#1) ^ (#2);" },
1186
- { "binop", "bit_xor_i", "uint64",
1187
- "(#3) = (#1) ^ (#2);" },
1188
- { "binop", "bit_xor_i", "boolean",
1189
- "(#3) = ((#1) != (#2)) ? 1 : 0;" },
1190
- { "binop", "bit_lshift", "int8",
1191
- "\n {\n int64_t _x = (int64_t) (#1), _n = (int64_t) (#2), _r;\n const int64_t _w = (int64_t) (8 * sizeof(<type>));\n if ( _n >= _w ) _r = 0;\n else if ( _n <= -_w ) _r = _x < 0 ? -1 : 0;\n else if ( _n < 0 ) _r = _x >> -_n;\n else _r = (int64_t) ((uint64_t) _x << _n);\n (#3) = (<type>) _r;\n }\n " },
1192
- { "binop", "bit_lshift", "uint8",
1193
- "(#3) = ((uint64_t) (#2) >= 8 * sizeof(<type>)) ? 0 : (<type>) ((uint64_t) (#1) << (#2));" },
1194
- { "binop", "bit_lshift", "int16",
1195
- "\n {\n int64_t _x = (int64_t) (#1), _n = (int64_t) (#2), _r;\n const int64_t _w = (int64_t) (8 * sizeof(<type>));\n if ( _n >= _w ) _r = 0;\n else if ( _n <= -_w ) _r = _x < 0 ? -1 : 0;\n else if ( _n < 0 ) _r = _x >> -_n;\n else _r = (int64_t) ((uint64_t) _x << _n);\n (#3) = (<type>) _r;\n }\n " },
1196
- { "binop", "bit_lshift", "uint16",
1197
- "(#3) = ((uint64_t) (#2) >= 8 * sizeof(<type>)) ? 0 : (<type>) ((uint64_t) (#1) << (#2));" },
1198
- { "binop", "bit_lshift", "int32",
1199
- "\n {\n int64_t _x = (int64_t) (#1), _n = (int64_t) (#2), _r;\n const int64_t _w = (int64_t) (8 * sizeof(<type>));\n if ( _n >= _w ) _r = 0;\n else if ( _n <= -_w ) _r = _x < 0 ? -1 : 0;\n else if ( _n < 0 ) _r = _x >> -_n;\n else _r = (int64_t) ((uint64_t) _x << _n);\n (#3) = (<type>) _r;\n }\n " },
1200
- { "binop", "bit_lshift", "uint32",
1201
- "(#3) = ((uint64_t) (#2) >= 8 * sizeof(<type>)) ? 0 : (<type>) ((uint64_t) (#1) << (#2));" },
1202
- { "binop", "bit_lshift", "int64",
1203
- "\n {\n int64_t _x = (int64_t) (#1), _n = (int64_t) (#2), _r;\n const int64_t _w = (int64_t) (8 * sizeof(<type>));\n if ( _n >= _w ) _r = 0;\n else if ( _n <= -_w ) _r = _x < 0 ? -1 : 0;\n else if ( _n < 0 ) _r = _x >> -_n;\n else _r = (int64_t) ((uint64_t) _x << _n);\n (#3) = (<type>) _r;\n }\n " },
1204
- { "binop", "bit_lshift", "uint64",
1205
- "(#3) = ((uint64_t) (#2) >= 8 * sizeof(<type>)) ? 0 : (<type>) ((uint64_t) (#1) << (#2));" },
1206
- { "binop", "bit_rshift", "int8",
1207
- "\n {\n int64_t _x = (int64_t) (#1), _n = (int64_t) (#2), _r;\n const int64_t _w = (int64_t) (8 * sizeof(<type>));\n if ( _n >= _w ) _r = _x < 0 ? -1 : 0;\n else if ( _n <= -_w ) _r = 0;\n else if ( _n < 0 ) _r = (int64_t) ((uint64_t) _x << -_n);\n else _r = _x >> _n;\n (#3) = (<type>) _r;\n }\n " },
1208
- { "binop", "bit_rshift", "uint8",
1209
- "(#3) = ((uint64_t) (#2) >= 8 * sizeof(<type>)) ? 0 : (<type>) ((uint64_t) (#1) >> (#2));" },
1210
- { "binop", "bit_rshift", "int16",
1211
- "\n {\n int64_t _x = (int64_t) (#1), _n = (int64_t) (#2), _r;\n const int64_t _w = (int64_t) (8 * sizeof(<type>));\n if ( _n >= _w ) _r = _x < 0 ? -1 : 0;\n else if ( _n <= -_w ) _r = 0;\n else if ( _n < 0 ) _r = (int64_t) ((uint64_t) _x << -_n);\n else _r = _x >> _n;\n (#3) = (<type>) _r;\n }\n " },
1212
- { "binop", "bit_rshift", "uint16",
1213
- "(#3) = ((uint64_t) (#2) >= 8 * sizeof(<type>)) ? 0 : (<type>) ((uint64_t) (#1) >> (#2));" },
1214
- { "binop", "bit_rshift", "int32",
1215
- "\n {\n int64_t _x = (int64_t) (#1), _n = (int64_t) (#2), _r;\n const int64_t _w = (int64_t) (8 * sizeof(<type>));\n if ( _n >= _w ) _r = _x < 0 ? -1 : 0;\n else if ( _n <= -_w ) _r = 0;\n else if ( _n < 0 ) _r = (int64_t) ((uint64_t) _x << -_n);\n else _r = _x >> _n;\n (#3) = (<type>) _r;\n }\n " },
1216
- { "binop", "bit_rshift", "uint32",
1217
- "(#3) = ((uint64_t) (#2) >= 8 * sizeof(<type>)) ? 0 : (<type>) ((uint64_t) (#1) >> (#2));" },
1218
- { "binop", "bit_rshift", "int64",
1219
- "\n {\n int64_t _x = (int64_t) (#1), _n = (int64_t) (#2), _r;\n const int64_t _w = (int64_t) (8 * sizeof(<type>));\n if ( _n >= _w ) _r = _x < 0 ? -1 : 0;\n else if ( _n <= -_w ) _r = 0;\n else if ( _n < 0 ) _r = (int64_t) ((uint64_t) _x << -_n);\n else _r = _x >> _n;\n (#3) = (<type>) _r;\n }\n " },
1220
- { "binop", "bit_rshift", "uint64",
1221
- "(#3) = ((uint64_t) (#2) >= 8 * sizeof(<type>)) ? 0 : (<type>) ((uint64_t) (#1) >> (#2));" },
1222
- { "binop", "and", "boolean",
1223
- "(#3) = (#1) && (#2);" },
1224
- { "binop", "or", "boolean",
1225
- "(#3) = (#1) || (#2);" },
1226
- { "binop", "xor", "boolean",
1227
- "(#3) = (((#1)==0) == ((#2)==0)) ? 0 : 1;" },
1228
- { "triop", "fma", "int8",
1229
- "(#4) = (#1) * (#2) + (#3);" },
1230
- { "triop", "fma", "uint8",
1231
- "(#4) = (#1) * (#2) + (#3);" },
1232
- { "triop", "fma", "int16",
1233
- "(#4) = (#1) * (#2) + (#3);" },
1234
- { "triop", "fma", "uint16",
1235
- "(#4) = (#1) * (#2) + (#3);" },
1236
- { "triop", "fma", "int32",
1237
- "(#4) = (#1) * (#2) + (#3);" },
1238
- { "triop", "fma", "uint32",
1239
- "(#4) = (#1) * (#2) + (#3);" },
1240
- { "triop", "fma", "int64",
1241
- "(#4) = (#1) * (#2) + (#3);" },
1242
- { "triop", "fma", "uint64",
1243
- "(#4) = (#1) * (#2) + (#3);" },
1244
- { "triop", "fma", "float32",
1245
- "(#4) = fmaf((#1), (#2), (#3));" },
1246
- { "triop", "fma", "float64",
1247
- "(#4) = fma((#1), (#2), (#3));" },
1248
- { "triop", "fma", "cmplx64",
1249
- "(#4) = (#1) * (#2) + (#3);" },
1250
- { "triop", "fma", "cmplx128",
1251
- "(#4) = (#1) * (#2) + (#3);" },
1252
- { "triop", "fms", "int8",
1253
- "(#4) = (#1) * (#2) - (#3);" },
1254
- { "triop", "fms", "uint8",
1255
- "(#4) = (#1) * (#2) - (#3);" },
1256
- { "triop", "fms", "int16",
1257
- "(#4) = (#1) * (#2) - (#3);" },
1258
- { "triop", "fms", "uint16",
1259
- "(#4) = (#1) * (#2) - (#3);" },
1260
- { "triop", "fms", "int32",
1261
- "(#4) = (#1) * (#2) - (#3);" },
1262
- { "triop", "fms", "uint32",
1263
- "(#4) = (#1) * (#2) - (#3);" },
1264
- { "triop", "fms", "int64",
1265
- "(#4) = (#1) * (#2) - (#3);" },
1266
- { "triop", "fms", "uint64",
1267
- "(#4) = (#1) * (#2) - (#3);" },
1268
- { "triop", "fms", "float32",
1269
- "(#4) = fmaf((#1), (#2), -(#3));" },
1270
- { "triop", "fms", "float64",
1271
- "(#4) = fma((#1), (#2), -(#3));" },
1272
- { "triop", "fms", "cmplx64",
1273
- "(#4) = (#1) * (#2) - (#3);" },
1274
- { "triop", "fms", "cmplx128",
1275
- "(#4) = (#1) * (#2) - (#3);" },
1276
- { "triop", "clip", "int8",
1277
- "(#4) = ((#1) < (#2)) ? (#2) : (((#1) > (#3)) ? (#3) : (#1));" },
1278
- { "triop", "clip", "uint8",
1279
- "(#4) = ((#1) < (#2)) ? (#2) : (((#1) > (#3)) ? (#3) : (#1));" },
1280
- { "triop", "clip", "int16",
1281
- "(#4) = ((#1) < (#2)) ? (#2) : (((#1) > (#3)) ? (#3) : (#1));" },
1282
- { "triop", "clip", "uint16",
1283
- "(#4) = ((#1) < (#2)) ? (#2) : (((#1) > (#3)) ? (#3) : (#1));" },
1284
- { "triop", "clip", "int32",
1285
- "(#4) = ((#1) < (#2)) ? (#2) : (((#1) > (#3)) ? (#3) : (#1));" },
1286
- { "triop", "clip", "uint32",
1287
- "(#4) = ((#1) < (#2)) ? (#2) : (((#1) > (#3)) ? (#3) : (#1));" },
1288
- { "triop", "clip", "int64",
1289
- "(#4) = ((#1) < (#2)) ? (#2) : (((#1) > (#3)) ? (#3) : (#1));" },
1290
- { "triop", "clip", "uint64",
1291
- "(#4) = ((#1) < (#2)) ? (#2) : (((#1) > (#3)) ? (#3) : (#1));" },
1292
- { "triop", "clip", "float32",
1293
- "(#4) = isnan(#1) ? (#1) : fmin(fmax((#1), (#2)), (#3));" },
1294
- { "triop", "clip", "float64",
1295
- "(#4) = isnan(#1) ? (#1) : fmin(fmax((#1), (#2)), (#3));" },
1296
- { "triop", "select", "int8",
1297
- "(#4) = (#1) ? (#2) : (#3);" },
1298
- { "triop", "select", "uint8",
1299
- "(#4) = (#1) ? (#2) : (#3);" },
1300
- { "triop", "select", "int16",
1301
- "(#4) = (#1) ? (#2) : (#3);" },
1302
- { "triop", "select", "uint16",
1303
- "(#4) = (#1) ? (#2) : (#3);" },
1304
- { "triop", "select", "int32",
1305
- "(#4) = (#1) ? (#2) : (#3);" },
1306
- { "triop", "select", "uint32",
1307
- "(#4) = (#1) ? (#2) : (#3);" },
1308
- { "triop", "select", "int64",
1309
- "(#4) = (#1) ? (#2) : (#3);" },
1310
- { "triop", "select", "uint64",
1311
- "(#4) = (#1) ? (#2) : (#3);" },
1312
- { "triop", "select", "float32",
1313
- "(#4) = (#1) ? (#2) : (#3);" },
1314
- { "triop", "select", "float64",
1315
- "(#4) = (#1) ? (#2) : (#3);" },
1316
- { "triop", "select", "boolean",
1317
- "(#4) = (#1) ? (#2) : (#3);" },
1318
- { "triop", "select", "cmplx64",
1319
- "(#4) = (#1) ? (#2) : (#3);" },
1320
- { "triop", "select", "cmplx128",
1321
- "(#4) = (#1) ? (#2) : (#3);" },
1322
- { "binop", "power", "int8",
1323
- "(#3) = op_powi_<type>((#1), (#2));" },
1324
- { "binop", "power", "uint8",
1325
- "(#3) = op_powi_<type>((#1), (#2));" },
1326
- { "binop", "power", "int16",
1327
- "(#3) = op_powi_<type>((#1), (#2));" },
1328
- { "binop", "power", "uint16",
1329
- "(#3) = op_powi_<type>((#1), (#2));" },
1330
- { "binop", "power", "int32",
1331
- "(#3) = op_powi_<type>((#1), (#2));" },
1332
- { "binop", "power", "uint32",
1333
- "(#3) = op_powi_<type>((#1), (#2));" },
1334
- { "binop", "power", "int64",
1335
- "(#3) = op_powi_<type>((#1), (#2));" },
1336
- { "binop", "power", "uint64",
1337
- "(#3) = op_powi_<type>((#1), (#2));" },
1338
- { "binop", "power", "float32",
1339
- "(#3) = (#2) == 2 ? (#1) * (#1) : (#2) == 3 ? (#1) * (#1) * (#1) : (#2) == 4 ? ((#1) * (#1)) * ((#1) * (#1)) : (#2) == 1 ? (#1) : (#2) == 0 ? 1 : (#2) == -1 ? 1 / (#1) : (#2) == -2 ? 1 / ((#1) * (#1)) : powf((#1), (#2));" },
1340
- { "binop", "power", "float64",
1341
- "(#3) = (#2) == 2 ? (#1) * (#1) : (#2) == 3 ? (#1) * (#1) * (#1) : (#2) == 4 ? ((#1) * (#1)) * ((#1) * (#1)) : (#2) == 1 ? (#1) : (#2) == 0 ? 1 : (#2) == -1 ? 1 / (#1) : (#2) == -2 ? 1 / ((#1) * (#1)) : pow((#1), (#2));" },
1342
- { "binop", "power", "cmplx64",
1343
- "(#3) = (#2) == 2 ? (#1) * (#1) : (#2) == 3 ? (#1) * (#1) * (#1) : (#2) == 4 ? ((#1) * (#1)) * ((#1) * (#1)) : (#2) == 1 ? (#1) : (#2) == 0 ? 1 : (#2) == -1 ? 1 / (#1) : (#2) == -2 ? 1 / ((#1) * (#1)) : cpow((#1), (#2));" },
1344
- { "binop", "power", "cmplx128",
1345
- "(#3) = (#2) == 2 ? (#1) * (#1) : (#2) == 3 ? (#1) * (#1) * (#1) : (#2) == 4 ? ((#1) * (#1)) * ((#1) * (#1)) : (#2) == 1 ? (#1) : (#2) == 0 ? 1 : (#2) == -1 ? 1 / (#1) : (#2) == -2 ? 1 / ((#1) * (#1)) : cpow((#1), (#2));" },
1346
- { "binop", "copysign", "float32",
1347
- "(#3) = copysignf((#1), (#2));" },
1348
- { "binop", "copysign", "float64",
1349
- "(#3) = copysign((#1), (#2));" },
1350
- { "binop", "nextafter", "float32",
1351
- "(#3) = nextafterf((#1), (#2));" },
1352
- { "binop", "nextafter", "float64",
1353
- "(#3) = nextafter((#1), (#2));" },
1354
- { "binop", "atan2", "float32",
1355
- "(#3) = atan2f((#1), (#2));" },
1356
- { "binop", "atan2", "float64",
1357
- "(#3) = atan2((#1), (#2));" },
1358
- { "binop", "hypot", "float32",
1359
- "(#3) = hypotf((#1), (#2));" },
1360
- { "binop", "hypot", "float64",
1361
- "(#3) = hypot((#1), (#2));" },
1362
- { "binop", "logaddexp", "float32",
1363
- "(#3) = fmaxf((#1), (#2)) + log1pf(expf(-fabsf((#1) - (#2))));" },
1364
- { "binop", "logaddexp", "float64",
1365
- "(#3) = fmax((#1), (#2)) + log1p(exp(-fabs((#1) - (#2))));" },
1366
- { "moncmp", "is_nan", "int8",
1367
- "(#2) = 0;" },
1368
- { "moncmp", "is_nan", "uint8",
1369
- "(#2) = 0;" },
1370
- { "moncmp", "is_nan", "int16",
1371
- "(#2) = 0;" },
1372
- { "moncmp", "is_nan", "uint16",
1373
- "(#2) = 0;" },
1374
- { "moncmp", "is_nan", "int32",
1375
- "(#2) = 0;" },
1376
- { "moncmp", "is_nan", "uint32",
1377
- "(#2) = 0;" },
1378
- { "moncmp", "is_nan", "int64",
1379
- "(#2) = 0;" },
1380
- { "moncmp", "is_nan", "uint64",
1381
- "(#2) = 0;" },
1382
- { "moncmp", "is_nan", "float32",
1383
- "(#2) = isnan(#1);" },
1384
- { "moncmp", "is_nan", "float64",
1385
- "(#2) = isnan(#1);" },
1386
- { "moncmp", "is_nan", "cmplx64",
1387
- "(#2) = (isnan(creal(#1)) || isnan(cimag(#1)));" },
1388
- { "moncmp", "is_nan", "cmplx128",
1389
- "(#2) = (isnan(creal(#1)) || isnan(cimag(#1)));" },
1390
- { "moncmp", "is_inf", "int8",
1391
- "(#2) = 0;" },
1392
- { "moncmp", "is_inf", "uint8",
1393
- "(#2) = 0;" },
1394
- { "moncmp", "is_inf", "int16",
1395
- "(#2) = 0;" },
1396
- { "moncmp", "is_inf", "uint16",
1397
- "(#2) = 0;" },
1398
- { "moncmp", "is_inf", "int32",
1399
- "(#2) = 0;" },
1400
- { "moncmp", "is_inf", "uint32",
1401
- "(#2) = 0;" },
1402
- { "moncmp", "is_inf", "int64",
1403
- "(#2) = 0;" },
1404
- { "moncmp", "is_inf", "uint64",
1405
- "(#2) = 0;" },
1406
- { "moncmp", "is_inf", "float32",
1407
- "(#2) = isinf(#1);" },
1408
- { "moncmp", "is_inf", "float64",
1409
- "(#2) = isinf(#1);" },
1410
- { "moncmp", "is_inf", "cmplx64",
1411
- "(#2) = (isinf(creal(#1)) || isinf(cimag(#1)));" },
1412
- { "moncmp", "is_inf", "cmplx128",
1413
- "(#2) = (isinf(creal(#1)) || isinf(cimag(#1)));" },
1414
- { "moncmp", "is_finite", "int8",
1415
- "(#2) = 1;" },
1416
- { "moncmp", "is_finite", "uint8",
1417
- "(#2) = 1;" },
1418
- { "moncmp", "is_finite", "int16",
1419
- "(#2) = 1;" },
1420
- { "moncmp", "is_finite", "uint16",
1421
- "(#2) = 1;" },
1422
- { "moncmp", "is_finite", "int32",
1423
- "(#2) = 1;" },
1424
- { "moncmp", "is_finite", "uint32",
1425
- "(#2) = 1;" },
1426
- { "moncmp", "is_finite", "int64",
1427
- "(#2) = 1;" },
1428
- { "moncmp", "is_finite", "uint64",
1429
- "(#2) = 1;" },
1430
- { "moncmp", "is_finite", "float32",
1431
- "(#2) = isfinite(#1);" },
1432
- { "moncmp", "is_finite", "float64",
1433
- "(#2) = isfinite(#1);" },
1434
- { "moncmp", "is_finite", "cmplx64",
1435
- "(#2) = (isfinite(creal(#1)) && isfinite(cimag(#1)));" },
1436
- { "moncmp", "is_finite", "cmplx128",
1437
- "(#2) = (isfinite(creal(#1)) && isfinite(cimag(#1)));" },
1438
- { "moncmp", "is_invalid", "int8",
1439
- "(#2) = 0;" },
1440
- { "moncmp", "is_invalid", "uint8",
1441
- "(#2) = 0;" },
1442
- { "moncmp", "is_invalid", "int16",
1443
- "(#2) = 0;" },
1444
- { "moncmp", "is_invalid", "uint16",
1445
- "(#2) = 0;" },
1446
- { "moncmp", "is_invalid", "int32",
1447
- "(#2) = 0;" },
1448
- { "moncmp", "is_invalid", "uint32",
1449
- "(#2) = 0;" },
1450
- { "moncmp", "is_invalid", "int64",
1451
- "(#2) = 0;" },
1452
- { "moncmp", "is_invalid", "uint64",
1453
- "(#2) = 0;" },
1454
- { "moncmp", "is_invalid", "float32",
1455
- "(#2) = (!isfinite(#1));" },
1456
- { "moncmp", "is_invalid", "float64",
1457
- "(#2) = (!isfinite(#1));" },
1458
- { "moncmp", "is_invalid", "boolean",
1459
- "(#2) = 0;" },
1460
- { "moncmp", "is_invalid", "cmplx64",
1461
- "(#2) = (!isfinite(creal(#1)) || !isfinite(cimag(#1)));" },
1462
- { "moncmp", "is_invalid", "cmplx128",
1463
- "(#2) = (!isfinite(creal(#1)) || !isfinite(cimag(#1)));" },
1464
- { "moncmp", "signbit", "int8",
1465
- "(#2) = ((#1) < 0);" },
1466
- { "moncmp", "signbit", "uint8",
1467
- "(#2) = 0;" },
1468
- { "moncmp", "signbit", "int16",
1469
- "(#2) = ((#1) < 0);" },
1470
- { "moncmp", "signbit", "uint16",
1471
- "(#2) = 0;" },
1472
- { "moncmp", "signbit", "int32",
1473
- "(#2) = ((#1) < 0);" },
1474
- { "moncmp", "signbit", "uint32",
1475
- "(#2) = 0;" },
1476
- { "moncmp", "signbit", "int64",
1477
- "(#2) = ((#1) < 0);" },
1478
- { "moncmp", "signbit", "uint64",
1479
- "(#2) = 0;" },
1480
- { "moncmp", "signbit", "float32",
1481
- "(#2) = signbit(#1);" },
1482
- { "moncmp", "signbit", "float64",
1483
- "(#2) = signbit(#1);" },
1484
- { "bincmp", "feq", "float32",
1485
- "\n <type> f1a = fabs((float64_t) #1);\n <type> f2a = fabs((float64_t) #2);\n <type> fmax = (f1a > f2a) ? f1a : f2a;\n (#3) = ( fabs(((float64_t) #1)-( (float64_t) #2)) <= fmax * <epsilon> ) ? 1 : 0;\n " },
1486
- { "bincmp", "feq", "float64",
1487
- "\n <type> f1a = fabs((float64_t) #1);\n <type> f2a = fabs((float64_t) #2);\n <type> fmax = (f1a > f2a) ? f1a : f2a;\n (#3) = ( fabs(((float64_t) #1)-( (float64_t) #2)) <= fmax * <epsilon> ) ? 1 : 0;\n " },
1488
- { "bincmp", "eq", "int8",
1489
- "(#3) = ( (#1) == (#2) );" },
1490
- { "bincmp", "eq", "uint8",
1491
- "(#3) = ( (#1) == (#2) );" },
1492
- { "bincmp", "eq", "int16",
1493
- "(#3) = ( (#1) == (#2) );" },
1494
- { "bincmp", "eq", "uint16",
1495
- "(#3) = ( (#1) == (#2) );" },
1496
- { "bincmp", "eq", "int32",
1497
- "(#3) = ( (#1) == (#2) );" },
1498
- { "bincmp", "eq", "uint32",
1499
- "(#3) = ( (#1) == (#2) );" },
1500
- { "bincmp", "eq", "int64",
1501
- "(#3) = ( (#1) == (#2) );" },
1502
- { "bincmp", "eq", "uint64",
1503
- "(#3) = ( (#1) == (#2) );" },
1504
- { "bincmp", "eq", "float32",
1505
- "(#3) = ( (#1) == (#2) );" },
1506
- { "bincmp", "eq", "float64",
1507
- "(#3) = ( (#1) == (#2) );" },
1508
- { "bincmp", "eq", "boolean",
1509
- "(#3) = ( (#1) == (#2) );" },
1510
- { "bincmp", "eq", "cmplx64",
1511
- "(#3) = (#1) == (#2);" },
1512
- { "bincmp", "eq", "cmplx128",
1513
- "(#3) = (#1) == (#2);" },
1514
- { "bincmp", "ne", "int8",
1515
- "(#3) = ( (#1) != (#2) );" },
1516
- { "bincmp", "ne", "uint8",
1517
- "(#3) = ( (#1) != (#2) );" },
1518
- { "bincmp", "ne", "int16",
1519
- "(#3) = ( (#1) != (#2) );" },
1520
- { "bincmp", "ne", "uint16",
1521
- "(#3) = ( (#1) != (#2) );" },
1522
- { "bincmp", "ne", "int32",
1523
- "(#3) = ( (#1) != (#2) );" },
1524
- { "bincmp", "ne", "uint32",
1525
- "(#3) = ( (#1) != (#2) );" },
1526
- { "bincmp", "ne", "int64",
1527
- "(#3) = ( (#1) != (#2) );" },
1528
- { "bincmp", "ne", "uint64",
1529
- "(#3) = ( (#1) != (#2) );" },
1530
- { "bincmp", "ne", "float32",
1531
- "(#3) = ( (#1) != (#2) );" },
1532
- { "bincmp", "ne", "float64",
1533
- "(#3) = ( (#1) != (#2) );" },
1534
- { "bincmp", "ne", "boolean",
1535
- "(#3) = ( (#1) != (#2) );" },
1536
- { "bincmp", "ne", "cmplx64",
1537
- "(#3) = (#1) != (#2);" },
1538
- { "bincmp", "ne", "cmplx128",
1539
- "(#3) = (#1) != (#2);" },
1540
- { "bincmp", "gt", "int8",
1541
- "(#3) = ( (#1) > (#2) );" },
1542
- { "bincmp", "gt", "uint8",
1543
- "(#3) = ( (#1) > (#2) );" },
1544
- { "bincmp", "gt", "int16",
1545
- "(#3) = ( (#1) > (#2) );" },
1546
- { "bincmp", "gt", "uint16",
1547
- "(#3) = ( (#1) > (#2) );" },
1548
- { "bincmp", "gt", "int32",
1549
- "(#3) = ( (#1) > (#2) );" },
1550
- { "bincmp", "gt", "uint32",
1551
- "(#3) = ( (#1) > (#2) );" },
1552
- { "bincmp", "gt", "int64",
1553
- "(#3) = ( (#1) > (#2) );" },
1554
- { "bincmp", "gt", "uint64",
1555
- "(#3) = ( (#1) > (#2) );" },
1556
- { "bincmp", "gt", "float32",
1557
- "(#3) = ( (#1) > (#2) );" },
1558
- { "bincmp", "gt", "float64",
1559
- "(#3) = ( (#1) > (#2) );" },
1560
- { "bincmp", "gt", "boolean",
1561
- "(#3) = ( (#1) > (#2) );" },
1562
- { "bincmp", "lt", "int8",
1563
- "(#3) = ( (#1) < (#2) );" },
1564
- { "bincmp", "lt", "uint8",
1565
- "(#3) = ( (#1) < (#2) );" },
1566
- { "bincmp", "lt", "int16",
1567
- "(#3) = ( (#1) < (#2) );" },
1568
- { "bincmp", "lt", "uint16",
1569
- "(#3) = ( (#1) < (#2) );" },
1570
- { "bincmp", "lt", "int32",
1571
- "(#3) = ( (#1) < (#2) );" },
1572
- { "bincmp", "lt", "uint32",
1573
- "(#3) = ( (#1) < (#2) );" },
1574
- { "bincmp", "lt", "int64",
1575
- "(#3) = ( (#1) < (#2) );" },
1576
- { "bincmp", "lt", "uint64",
1577
- "(#3) = ( (#1) < (#2) );" },
1578
- { "bincmp", "lt", "float32",
1579
- "(#3) = ( (#1) < (#2) );" },
1580
- { "bincmp", "lt", "float64",
1581
- "(#3) = ( (#1) < (#2) );" },
1582
- { "bincmp", "lt", "boolean",
1583
- "(#3) = ( (#1) < (#2) );" },
1584
- { "bincmp", "ge", "int8",
1585
- "(#3) = ( (#1) >= (#2) );" },
1586
- { "bincmp", "ge", "uint8",
1587
- "(#3) = ( (#1) >= (#2) );" },
1588
- { "bincmp", "ge", "int16",
1589
- "(#3) = ( (#1) >= (#2) );" },
1590
- { "bincmp", "ge", "uint16",
1591
- "(#3) = ( (#1) >= (#2) );" },
1592
- { "bincmp", "ge", "int32",
1593
- "(#3) = ( (#1) >= (#2) );" },
1594
- { "bincmp", "ge", "uint32",
1595
- "(#3) = ( (#1) >= (#2) );" },
1596
- { "bincmp", "ge", "int64",
1597
- "(#3) = ( (#1) >= (#2) );" },
1598
- { "bincmp", "ge", "uint64",
1599
- "(#3) = ( (#1) >= (#2) );" },
1600
- { "bincmp", "ge", "float32",
1601
- "(#3) = ( (#1) >= (#2) );" },
1602
- { "bincmp", "ge", "float64",
1603
- "(#3) = ( (#1) >= (#2) );" },
1604
- { "bincmp", "ge", "boolean",
1605
- "(#3) = ( (#1) >= (#2) );" },
1606
- { "bincmp", "le", "int8",
1607
- "(#3) = ( (#1) <= (#2) );" },
1608
- { "bincmp", "le", "uint8",
1609
- "(#3) = ( (#1) <= (#2) );" },
1610
- { "bincmp", "le", "int16",
1611
- "(#3) = ( (#1) <= (#2) );" },
1612
- { "bincmp", "le", "uint16",
1613
- "(#3) = ( (#1) <= (#2) );" },
1614
- { "bincmp", "le", "int32",
1615
- "(#3) = ( (#1) <= (#2) );" },
1616
- { "bincmp", "le", "uint32",
1617
- "(#3) = ( (#1) <= (#2) );" },
1618
- { "bincmp", "le", "int64",
1619
- "(#3) = ( (#1) <= (#2) );" },
1620
- { "bincmp", "le", "uint64",
1621
- "(#3) = ( (#1) <= (#2) );" },
1622
- { "bincmp", "le", "float32",
1623
- "(#3) = ( (#1) <= (#2) );" },
1624
- { "bincmp", "le", "float64",
1625
- "(#3) = ( (#1) <= (#2) );" },
1626
- { "bincmp", "le", "boolean",
1627
- "(#3) = ( (#1) <= (#2) );" },
1628
- { "bincmp", "is_close", "int8",
1629
- "(#3) = (fabs((double)(#1) - (double)(#2)) <= tol) ? 1 : 0;" },
1630
- { "bincmp", "is_close", "uint8",
1631
- "(#3) = (fabs((double)(#1) - (double)(#2)) <= tol) ? 1 : 0;" },
1632
- { "bincmp", "is_close", "int16",
1633
- "(#3) = (fabs((double)(#1) - (double)(#2)) <= tol) ? 1 : 0;" },
1634
- { "bincmp", "is_close", "uint16",
1635
- "(#3) = (fabs((double)(#1) - (double)(#2)) <= tol) ? 1 : 0;" },
1636
- { "bincmp", "is_close", "int32",
1637
- "(#3) = (fabs((double)(#1) - (double)(#2)) <= tol) ? 1 : 0;" },
1638
- { "bincmp", "is_close", "uint32",
1639
- "(#3) = (fabs((double)(#1) - (double)(#2)) <= tol) ? 1 : 0;" },
1640
- { "bincmp", "is_close", "int64",
1641
- "(#3) = (fabs((double)(#1) - (double)(#2)) <= tol) ? 1 : 0;" },
1642
- { "bincmp", "is_close", "uint64",
1643
- "(#3) = (fabs((double)(#1) - (double)(#2)) <= tol) ? 1 : 0;" },
1644
- { "bincmp", "is_close", "float32",
1645
- "(#3) = (fabs((#1) - (#2)) <= tol) ? 1 : 0;" },
1646
- { "bincmp", "is_close", "float64",
1647
- "(#3) = (fabs((#1) - (#2)) <= tol) ? 1 : 0;" },
1648
- { "bincmp", "is_close", "cmplx64",
1649
- "(#3) = (cabs((#1) - (#2)) <= tol) ? 1 : 0;" },
1650
- { "bincmp", "is_close", "cmplx128",
1651
- "(#3) = (cabs((#1) - (#2)) <= tol) ? 1 : 0;" },
1652
- { "bincmp", "is_equiv", "int8",
1653
- "\n double a = (double)(#1), b = (double)(#2);\n double aa = fabs(a), ab = fabs(b);\n double m = (aa > ab) ? aa : ab;\n (#3) = ( (#1) == (#2) || (m > 0 && fabs(a - b) / m <= tol) ) ? 1 : 0;\n " },
1654
- { "bincmp", "is_equiv", "uint8",
1655
- "\n double a = (double)(#1), b = (double)(#2);\n double aa = fabs(a), ab = fabs(b);\n double m = (aa > ab) ? aa : ab;\n (#3) = ( (#1) == (#2) || (m > 0 && fabs(a - b) / m <= tol) ) ? 1 : 0;\n " },
1656
- { "bincmp", "is_equiv", "int16",
1657
- "\n double a = (double)(#1), b = (double)(#2);\n double aa = fabs(a), ab = fabs(b);\n double m = (aa > ab) ? aa : ab;\n (#3) = ( (#1) == (#2) || (m > 0 && fabs(a - b) / m <= tol) ) ? 1 : 0;\n " },
1658
- { "bincmp", "is_equiv", "uint16",
1659
- "\n double a = (double)(#1), b = (double)(#2);\n double aa = fabs(a), ab = fabs(b);\n double m = (aa > ab) ? aa : ab;\n (#3) = ( (#1) == (#2) || (m > 0 && fabs(a - b) / m <= tol) ) ? 1 : 0;\n " },
1660
- { "bincmp", "is_equiv", "int32",
1661
- "\n double a = (double)(#1), b = (double)(#2);\n double aa = fabs(a), ab = fabs(b);\n double m = (aa > ab) ? aa : ab;\n (#3) = ( (#1) == (#2) || (m > 0 && fabs(a - b) / m <= tol) ) ? 1 : 0;\n " },
1662
- { "bincmp", "is_equiv", "uint32",
1663
- "\n double a = (double)(#1), b = (double)(#2);\n double aa = fabs(a), ab = fabs(b);\n double m = (aa > ab) ? aa : ab;\n (#3) = ( (#1) == (#2) || (m > 0 && fabs(a - b) / m <= tol) ) ? 1 : 0;\n " },
1664
- { "bincmp", "is_equiv", "int64",
1665
- "\n double a = (double)(#1), b = (double)(#2);\n double aa = fabs(a), ab = fabs(b);\n double m = (aa > ab) ? aa : ab;\n (#3) = ( (#1) == (#2) || (m > 0 && fabs(a - b) / m <= tol) ) ? 1 : 0;\n " },
1666
- { "bincmp", "is_equiv", "uint64",
1667
- "\n double a = (double)(#1), b = (double)(#2);\n double aa = fabs(a), ab = fabs(b);\n double m = (aa > ab) ? aa : ab;\n (#3) = ( (#1) == (#2) || (m > 0 && fabs(a - b) / m <= tol) ) ? 1 : 0;\n " },
1668
- { "bincmp", "is_equiv", "float32",
1669
- "\n <type> aa = fabs((#1)), ab = fabs((#2));\n <type> m = (aa > ab) ? aa : ab;\n (#3) = ( (#1) == (#2) || (m > 0 && fabs((#1) - (#2)) / m <= tol) ) ? 1 : 0;\n " },
1670
- { "bincmp", "is_equiv", "float64",
1671
- "\n <type> aa = fabs((#1)), ab = fabs((#2));\n <type> m = (aa > ab) ? aa : ab;\n (#3) = ( (#1) == (#2) || (m > 0 && fabs((#1) - (#2)) / m <= tol) ) ? 1 : 0;\n " },
1672
- { "bincmp", "is_equiv", "cmplx64",
1673
- "\n double aa = cabs((#1)), ab = cabs((#2));\n double m = (aa > ab) ? aa : ab;\n (#3) = ( m > 0 && cabs((#1) - (#2)) / m <= tol ) ? 1 : 0;\n " },
1674
- { "bincmp", "is_equiv", "cmplx128",
1675
- "\n double aa = cabs((#1)), ab = cabs((#2));\n double m = (aa > ab) ? aa : ab;\n (#3) = ( m > 0 && cabs((#1) - (#2)) / m <= tol ) ? 1 : 0;\n " },
1676
- };
1677
-
1678
- static const int ca_kernel_bodies_count = 823;
1679
-
1680
- /* CArray.__kernel_body__(kind, name, data_type) -> String, or nil where
1681
- this operation has no body at that data type. */
1682
- static VALUE
1683
- rb_ca_s_kernel_body (VALUE klass, VALUE rkind, VALUE rname, VALUE rtype)
1684
- {
1685
- VALUE kind = rb_obj_as_string(rkind);
1686
- VALUE name = rb_obj_as_string(rname);
1687
- VALUE type = rb_obj_as_string(rtype);
1688
- const char *k = StringValueCStr(kind);
1689
- const char *n = StringValueCStr(name);
1690
- const char *t = StringValueCStr(type);
1691
- int i;
1692
- for ( i = 0; i < ca_kernel_bodies_count; i++ ) {
1693
- const ca_kernel_body_t *e = &ca_kernel_bodies[i];
1694
- if ( strcmp(e->kind, k) == 0 &&
1695
- strcmp(e->name, n) == 0 &&
1696
- strcmp(e->data_type, t) == 0 ) {
1697
- return rb_str_new_cstr(e->body);
1698
- }
1699
- }
1700
- return Qnil;
1701
- }
1702
-
1703
- /* CArray.__kernel_helpers__ -> String: the C a body above may call
1704
- beyond the standard library, for the caller to put ahead of it. */
1705
- static const char ca_kernel_helpers[] =
1706
- "\n/* x raised to a non-negative power, by binary exponentiation. The power\n is unsigned so that the magnitude of INT64_MIN is representable. */\n#define op_powi_magnitude(type) \\\nstatic inline type \\\nop_powi_mag_## type (type x, uint64_t p) \\\n{ \\\n type r=1; \\\n\\\n switch(p) { \\\n case 2: return x*x; \\\n case 3: return x*x*x; \\\n case 0: return 1; \\\n case 1: return x; \\\n } \\\n while (p) { \\\n if ( p & 1 ) r *= x; \\\n x *= x; \\\n p >>= 1; \\\n } \\\n return r; \\\n}\n\n/* An integer to a negative power is 1/x^|p| in integer division, which is\n decided by x alone: 0 has no reciprocal, 1 and -1 keep their magnitude,\n anything larger truncates to 0. Answering it that way, rather than by\n computing x^|p|, keeps a power that overflows -- 2 ** -64 -- from wrapping\n to a zero divisor. */\n#define op_powi(type) \\\nop_powi_magnitude(type) \\\nstatic inline type \\\nop_powi_## type (type x, int64_t p) \\\n{ \\\n if ( p < 0 ) { \\\n if ( x == 0 ) ca_zerodiv(); \\\n if ( x == 1 ) return 1; \\\n if ( x == (type) -1 ) return ( p % 2 ) ? x : 1; \\\n return 0; \\\n } \\\n return op_powi_mag_## type(x, (uint64_t) p); \\\n}\n\n/* An unsigned x is never -1; (type) -1 is its largest value. */\n#define op_powi_u(type) \\\nop_powi_magnitude(type) \\\nstatic inline type \\\nop_powi_## type (type x, int64_t p) \\\n{ \\\n if ( p < 0 ) { \\\n if ( x == 0 ) ca_zerodiv(); \\\n return ( x == 1 ) ? 1 : 0; \\\n } \\\n return op_powi_mag_## type(x, (uint64_t) p); \\\n}\n\nop_powi(int8_t)\nop_powi_u(uint8_t)\nop_powi(int16_t)\nop_powi_u(uint16_t)\nop_powi(int32_t)\nop_powi_u(uint32_t)\nop_powi(int64_t)\nop_powi_u(uint64_t)\n\n";
1707
-
1708
- static VALUE
1709
- rb_ca_s_kernel_helpers (VALUE klass)
1710
- {
1711
- return rb_str_new_cstr(ca_kernel_helpers);
1712
- }
1713
-
1714
- void
1715
- Init_carray_kernels (void)
1716
- {
1717
- Init_carray_kernels_reduce_aggregate();
1718
- Init_carray_kernels_reduce_extreme();
1719
- Init_carray_kernels_reduce_boolean();
1720
- Init_carray_kernels_reduce_variance();
1721
- Init_carray_kernels_reduce_cumulative();
1722
- Init_carray_kernels_scan();
1723
- Init_carray_kernels_sort();
1724
- Init_carray_kernels_search();
1725
- Init_carray_kernels_monop();
1726
- Init_carray_kernels_binop();
1727
- Init_carray_kernels_triop();
1728
- Init_carray_kernels_moncmp();
1729
- Init_carray_kernels_bincmp();
1730
- rb_define_singleton_method(rb_cCArray, "__kernel_body__",
1731
- rb_ca_s_kernel_body, 3);
1732
- rb_define_singleton_method(rb_cCArray, "__kernel_helpers__",
1733
- rb_ca_s_kernel_helpers, 0);
1734
- }