noobs 0.0.6

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 (185) hide show
  1. package/COPYING +339 -0
  2. package/README.md +46 -0
  3. package/bin/64bit/obs.lib +0 -0
  4. package/binding.gyp +23 -0
  5. package/dist/bin/Qt6Core.dll +0 -0
  6. package/dist/bin/Qt6Gui.dll +0 -0
  7. package/dist/bin/Qt6Network.dll +0 -0
  8. package/dist/bin/Qt6Svg.dll +0 -0
  9. package/dist/bin/Qt6Widgets.dll +0 -0
  10. package/dist/bin/Qt6Xml.dll +0 -0
  11. package/dist/bin/avcodec-61.dll +0 -0
  12. package/dist/bin/avdevice-61.dll +0 -0
  13. package/dist/bin/avfilter-10.dll +0 -0
  14. package/dist/bin/avformat-61.dll +0 -0
  15. package/dist/bin/avutil-59.dll +0 -0
  16. package/dist/bin/datachannel.dll +0 -0
  17. package/dist/bin/libcurl.dll +0 -0
  18. package/dist/bin/libobs-d3d11.dll +0 -0
  19. package/dist/bin/libobs-opengl.dll +0 -0
  20. package/dist/bin/libobs-winrt.dll +0 -0
  21. package/dist/bin/librist.dll +0 -0
  22. package/dist/bin/libx264-164.dll +0 -0
  23. package/dist/bin/lua51.dll +0 -0
  24. package/dist/bin/obs-amf-test.exe +0 -0
  25. package/dist/bin/obs-ffmpeg-mux.exe +0 -0
  26. package/dist/bin/obs-frontend-api.dll +0 -0
  27. package/dist/bin/obs-scripting.dll +0 -0
  28. package/dist/bin/obs.dll +0 -0
  29. package/dist/bin/srt.dll +0 -0
  30. package/dist/bin/swresample-5.dll +0 -0
  31. package/dist/bin/swscale-8.dll +0 -0
  32. package/dist/bin/w32-pthreads.dll +0 -0
  33. package/dist/bin/zlib.dll +0 -0
  34. package/dist/effects/area.effect +250 -0
  35. package/dist/effects/bicubic_scale.effect +236 -0
  36. package/dist/effects/bilinear_lowres_scale.effect +123 -0
  37. package/dist/effects/color.effect +172 -0
  38. package/dist/effects/default.effect +254 -0
  39. package/dist/effects/default_rect.effect +84 -0
  40. package/dist/effects/deinterlace_base.effect +325 -0
  41. package/dist/effects/deinterlace_blend.effect +21 -0
  42. package/dist/effects/deinterlace_blend_2x.effect +21 -0
  43. package/dist/effects/deinterlace_discard.effect +21 -0
  44. package/dist/effects/deinterlace_discard_2x.effect +21 -0
  45. package/dist/effects/deinterlace_linear.effect +21 -0
  46. package/dist/effects/deinterlace_linear_2x.effect +21 -0
  47. package/dist/effects/deinterlace_yadif.effect +21 -0
  48. package/dist/effects/deinterlace_yadif_2x.effect +21 -0
  49. package/dist/effects/format_conversion.effect +1823 -0
  50. package/dist/effects/lanczos_scale.effect +292 -0
  51. package/dist/effects/opaque.effect +159 -0
  52. package/dist/effects/premultiplied_alpha.effect +38 -0
  53. package/dist/effects/repeat.effect +36 -0
  54. package/dist/effects/solid.effect +80 -0
  55. package/dist/noobs.node +0 -0
  56. package/dist/plugins/obs-ffmpeg.dll +0 -0
  57. package/dist/plugins/obs-x264.dll +0 -0
  58. package/dist/plugins/win-capture.dll +0 -0
  59. package/include/audio-monitoring/osx/mac-helpers.h +13 -0
  60. package/include/audio-monitoring/pulse/pulseaudio-wrapper.h +212 -0
  61. package/include/audio-monitoring/win32/wasapi-output.h +22 -0
  62. package/include/callback/calldata.h +195 -0
  63. package/include/callback/decl.h +61 -0
  64. package/include/callback/proc.h +52 -0
  65. package/include/callback/signal.h +73 -0
  66. package/include/graphics/axisang.h +65 -0
  67. package/include/graphics/bounds.h +108 -0
  68. package/include/graphics/device-exports.h +177 -0
  69. package/include/graphics/effect-parser.h +290 -0
  70. package/include/graphics/effect.h +190 -0
  71. package/include/graphics/graphics-internal.h +335 -0
  72. package/include/graphics/graphics.h +1024 -0
  73. package/include/graphics/half.h +100 -0
  74. package/include/graphics/image-file.h +124 -0
  75. package/include/graphics/input.h +34 -0
  76. package/include/graphics/libnsgif/libnsgif.h +142 -0
  77. package/include/graphics/math-defs.h +45 -0
  78. package/include/graphics/math-extra.h +61 -0
  79. package/include/graphics/matrix3.h +98 -0
  80. package/include/graphics/matrix4.h +102 -0
  81. package/include/graphics/plane.h +85 -0
  82. package/include/graphics/quat.h +170 -0
  83. package/include/graphics/shader-parser.h +273 -0
  84. package/include/graphics/srgb.h +177 -0
  85. package/include/graphics/vec2.h +148 -0
  86. package/include/graphics/vec3.h +224 -0
  87. package/include/graphics/vec4.h +241 -0
  88. package/include/media-io/audio-io.h +228 -0
  89. package/include/media-io/audio-math.h +43 -0
  90. package/include/media-io/audio-resampler.h +44 -0
  91. package/include/media-io/format-conversion.h +50 -0
  92. package/include/media-io/frame-rate.h +29 -0
  93. package/include/media-io/media-io-defs.h +20 -0
  94. package/include/media-io/media-remux.h +37 -0
  95. package/include/media-io/video-frame.h +64 -0
  96. package/include/media-io/video-io.h +338 -0
  97. package/include/media-io/video-scaler.h +43 -0
  98. package/include/obs-audio-controls.h +250 -0
  99. package/include/obs-av1.h +47 -0
  100. package/include/obs-avc.h +55 -0
  101. package/include/obs-config.h +52 -0
  102. package/include/obs-data.h +311 -0
  103. package/include/obs-defs.h +52 -0
  104. package/include/obs-encoder.h +361 -0
  105. package/include/obs-ffmpeg-compat.h +13 -0
  106. package/include/obs-hevc.h +81 -0
  107. package/include/obs-hotkey.h +271 -0
  108. package/include/obs-hotkeys.h +653 -0
  109. package/include/obs-interaction.h +56 -0
  110. package/include/obs-internal.h +1459 -0
  111. package/include/obs-missing-files.h +53 -0
  112. package/include/obs-module.h +181 -0
  113. package/include/obs-nal.h +37 -0
  114. package/include/obs-nix-platform.h +53 -0
  115. package/include/obs-nix-wayland.h +24 -0
  116. package/include/obs-nix-x11.h +22 -0
  117. package/include/obs-nix.h +42 -0
  118. package/include/obs-output.h +96 -0
  119. package/include/obs-properties.h +364 -0
  120. package/include/obs-scene.h +127 -0
  121. package/include/obs-service.h +115 -0
  122. package/include/obs-source.h +568 -0
  123. package/include/obs.h +2608 -0
  124. package/include/obsconfig.h +13 -0
  125. package/include/obsversion.h +5 -0
  126. package/include/util/apple/cfstring-utils.h +16 -0
  127. package/include/util/array-serializer.h +37 -0
  128. package/include/util/base.h +97 -0
  129. package/include/util/bitstream.h +28 -0
  130. package/include/util/bmem.h +94 -0
  131. package/include/util/buffered-file-serializer.h +32 -0
  132. package/include/util/c99defs.h +75 -0
  133. package/include/util/cf-lexer.h +199 -0
  134. package/include/util/cf-parser.h +281 -0
  135. package/include/util/circlebuf.h +319 -0
  136. package/include/util/config-file.h +103 -0
  137. package/include/util/crc32.h +29 -0
  138. package/include/util/curl/curl-helper.h +35 -0
  139. package/include/util/darray.h +606 -0
  140. package/include/util/deque.h +319 -0
  141. package/include/util/dstr.h +320 -0
  142. package/include/util/file-serializer.h +34 -0
  143. package/include/util/lexer.h +273 -0
  144. package/include/util/pipe.h +52 -0
  145. package/include/util/platform.h +223 -0
  146. package/include/util/profiler.h +97 -0
  147. package/include/util/serializer.h +158 -0
  148. package/include/util/simde/check.h +285 -0
  149. package/include/util/simde/debug-trap.h +117 -0
  150. package/include/util/simde/hedley.h +2123 -0
  151. package/include/util/simde/simde-align.h +481 -0
  152. package/include/util/simde/simde-arch.h +537 -0
  153. package/include/util/simde/simde-common.h +918 -0
  154. package/include/util/simde/simde-constify.h +925 -0
  155. package/include/util/simde/simde-detect-clang.h +114 -0
  156. package/include/util/simde/simde-diagnostic.h +447 -0
  157. package/include/util/simde/simde-features.h +550 -0
  158. package/include/util/simde/simde-math.h +1858 -0
  159. package/include/util/simde/x86/mmx.h +2456 -0
  160. package/include/util/simde/x86/sse.h +4479 -0
  161. package/include/util/simde/x86/sse2.h +7549 -0
  162. package/include/util/source-profiler.h +66 -0
  163. package/include/util/sse-intrin.h +32 -0
  164. package/include/util/task.h +22 -0
  165. package/include/util/text-lookup.h +45 -0
  166. package/include/util/threading-posix.h +77 -0
  167. package/include/util/threading-windows.h +142 -0
  168. package/include/util/threading.h +103 -0
  169. package/include/util/utf8.h +35 -0
  170. package/include/util/uthash.h +34 -0
  171. package/include/util/util_uint128.h +108 -0
  172. package/include/util/util_uint64.h +34 -0
  173. package/include/util/windows/device-enum.h +14 -0
  174. package/include/util/windows/obfuscate.h +16 -0
  175. package/include/util/windows/win-registry.h +37 -0
  176. package/include/util/windows/win-version.h +57 -0
  177. package/include/util/windows/window-helpers.h +47 -0
  178. package/index.d.ts +38 -0
  179. package/index.js +8 -0
  180. package/package.json +31 -0
  181. package/src/main.cpp +321 -0
  182. package/src/obs_interface.cpp +605 -0
  183. package/src/obs_interface.h +74 -0
  184. package/src/utils.cpp +80 -0
  185. package/src/utils.h +3 -0
@@ -0,0 +1,918 @@
1
+ /* SPDX-License-Identifier: MIT
2
+ *
3
+ * Permission is hereby granted, free of charge, to any person
4
+ * obtaining a copy of this software and associated documentation
5
+ * files (the "Software"), to deal in the Software without
6
+ * restriction, including without limitation the rights to use, copy,
7
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
8
+ * of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be
12
+ * included in all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
18
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ * SOFTWARE.
22
+ *
23
+ * Copyright:
24
+ * 2017-2020 Evan Nemerson <evan@nemerson.com>
25
+ */
26
+
27
+ #if !defined(SIMDE_COMMON_H)
28
+ #define SIMDE_COMMON_H
29
+
30
+ #include "hedley.h"
31
+
32
+ #define SIMDE_VERSION_MAJOR 0
33
+ #define SIMDE_VERSION_MINOR 7
34
+ #define SIMDE_VERSION_MICRO 1
35
+ #define SIMDE_VERSION \
36
+ HEDLEY_VERSION_ENCODE(SIMDE_VERSION_MAJOR, SIMDE_VERSION_MINOR, \
37
+ SIMDE_VERSION_MICRO)
38
+
39
+ #include <stddef.h>
40
+ #include <stdint.h>
41
+
42
+ #include "simde-detect-clang.h"
43
+ #include "simde-arch.h"
44
+ #include "simde-features.h"
45
+ #include "simde-diagnostic.h"
46
+ #include "simde-math.h"
47
+ #include "simde-constify.h"
48
+ #include "simde-align.h"
49
+
50
+ /* In some situations, SIMDe has to make large performance sacrifices
51
+ * for small increases in how faithfully it reproduces an API, but
52
+ * only a relatively small number of users will actually need the API
53
+ * to be completely accurate. The SIMDE_FAST_* options can be used to
54
+ * disable these trade-offs.
55
+ *
56
+ * They can be enabled by passing -DSIMDE_FAST_MATH to the compiler, or
57
+ * the individual defines (e.g., -DSIMDE_FAST_NANS) if you only want to
58
+ * enable some optimizations. Using -ffast-math and/or
59
+ * -ffinite-math-only will also enable the relevant options. If you
60
+ * don't want that you can pass -DSIMDE_NO_FAST_* to disable them. */
61
+
62
+ /* Most programs avoid NaNs by never passing values which can result in
63
+ * a NaN; for example, if you only pass non-negative values to the sqrt
64
+ * functions, it won't generate a NaN. On some platforms, similar
65
+ * functions handle NaNs differently; for example, the _mm_min_ps SSE
66
+ * function will return 0.0 if you pass it (0.0, NaN), but the NEON
67
+ * vminq_f32 function will return NaN. Making them behave like one
68
+ * another is expensive; it requires generating a mask of all lanes
69
+ * with NaNs, then performing the operation (e.g., vminq_f32), then
70
+ * blending together the result with another vector using the mask.
71
+ *
72
+ * If you don't want SIMDe to worry about the differences between how
73
+ * NaNs are handled on the two platforms, define this (or pass
74
+ * -ffinite-math-only) */
75
+ #if !defined(SIMDE_FAST_MATH) && !defined(SIMDE_NO_FAST_MATH) && \
76
+ defined(__FAST_MATH__)
77
+ #define SIMDE_FAST_MATH
78
+ #endif
79
+
80
+ #if !defined(SIMDE_FAST_NANS) && !defined(SIMDE_NO_FAST_NANS)
81
+ #if defined(SIMDE_FAST_MATH)
82
+ #define SIMDE_FAST_NANS
83
+ #elif defined(__FINITE_MATH_ONLY__)
84
+ #if __FINITE_MATH_ONLY__
85
+ #define SIMDE_FAST_NANS
86
+ #endif
87
+ #endif
88
+ #endif
89
+
90
+ /* Many functions are defined as using the current rounding mode
91
+ * (i.e., the SIMD version of fegetround()) when converting to
92
+ * an integer. For example, _mm_cvtpd_epi32. Unfortunately,
93
+ * on some platforms (such as ARMv8+ where round-to-nearest is
94
+ * always used, regardless of the FPSCR register) this means we
95
+ * have to first query the current rounding mode, then choose
96
+ * the proper function (rounnd
97
+ , ceil, floor, etc.) */
98
+ #if !defined(SIMDE_FAST_ROUND_MODE) && !defined(SIMDE_NO_FAST_ROUND_MODE) && \
99
+ defined(SIMDE_FAST_MATH)
100
+ #define SIMDE_FAST_ROUND_MODE
101
+ #endif
102
+
103
+ /* This controls how ties are rounded. For example, does 10.5 round to
104
+ * 10 or 11? IEEE 754 specifies round-towards-even, but ARMv7 (for
105
+ * example) doesn't support it and it must be emulated (which is rather
106
+ * slow). If you're okay with just using the default for whatever arch
107
+ * you're on, you should definitely define this.
108
+ *
109
+ * Note that we don't use this macro to avoid correct implementations
110
+ * in functions which are explicitly about rounding (such as vrnd* on
111
+ * NEON, _mm_round_* on x86, etc.); it is only used for code where
112
+ * rounding is a component in another function, and even then it isn't
113
+ * usually a problem since such functions will use the current rounding
114
+ * mode. */
115
+ #if !defined(SIMDE_FAST_ROUND_TIES) && !defined(SIMDE_NO_FAST_ROUND_TIES) && \
116
+ defined(SIMDE_FAST_MATH)
117
+ #define SIMDE_FAST_ROUND_TIES
118
+ #endif
119
+
120
+ /* For functions which convert from one type to another (mostly from
121
+ * floating point to integer types), sometimes we need to do a range
122
+ * check and potentially return a different result if the value
123
+ * falls outside that range. Skipping this check can provide a
124
+ * performance boost, at the expense of faithfulness to the API we're
125
+ * emulating. */
126
+ #if !defined(SIMDE_FAST_CONVERSION_RANGE) && \
127
+ !defined(SIMDE_NO_FAST_CONVERSION_RANGE) && defined(SIMDE_FAST_MATH)
128
+ #define SIMDE_FAST_CONVERSION_RANGE
129
+ #endif
130
+
131
+ #if HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \
132
+ HEDLEY_GCC_VERSION_CHECK(3, 4, 0) || \
133
+ HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
134
+ HEDLEY_TINYC_VERSION_CHECK(0, 9, 19) || \
135
+ HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \
136
+ HEDLEY_IBM_VERSION_CHECK(13, 1, 0) || \
137
+ HEDLEY_TI_CL6X_VERSION_CHECK(6, 1, 0) || \
138
+ (HEDLEY_SUNPRO_VERSION_CHECK(5, 10, 0) && !defined(__cplusplus)) || \
139
+ HEDLEY_CRAY_VERSION_CHECK(8, 1, 0)
140
+ #define SIMDE_CHECK_CONSTANT_(expr) (__builtin_constant_p(expr))
141
+ #elif defined(__cplusplus) && (__cplusplus > 201703L)
142
+ #include <type_traits>
143
+ #define SIMDE_CHECK_CONSTANT_(expr) (std::is_constant_evaluated())
144
+ #endif
145
+
146
+ #if !defined(SIMDE_NO_CHECK_IMMEDIATE_CONSTANT)
147
+ #if defined(SIMDE_CHECK_CONSTANT_) && \
148
+ SIMDE_DETECT_CLANG_VERSION_CHECK(9, 0, 0) && \
149
+ (!defined(__apple_build_version__) || \
150
+ ((__apple_build_version__ < 11000000) || \
151
+ (__apple_build_version__ >= 12000000)))
152
+ #define SIMDE_REQUIRE_CONSTANT(arg) \
153
+ HEDLEY_REQUIRE_MSG(SIMDE_CHECK_CONSTANT_(arg), \
154
+ "`" #arg "' must be constant")
155
+ #else
156
+ #define SIMDE_REQUIRE_CONSTANT(arg)
157
+ #endif
158
+ #else
159
+ #define SIMDE_REQUIRE_CONSTANT(arg)
160
+ #endif
161
+
162
+ #define SIMDE_REQUIRE_RANGE(arg, min, max) \
163
+ HEDLEY_REQUIRE_MSG((((arg) >= (min)) && ((arg) <= (max))), \
164
+ "'" #arg "' must be in [" #min ", " #max "]")
165
+
166
+ #define SIMDE_REQUIRE_CONSTANT_RANGE(arg, min, max) \
167
+ SIMDE_REQUIRE_CONSTANT(arg) \
168
+ SIMDE_REQUIRE_RANGE(arg, min, max)
169
+
170
+ /* A copy of HEDLEY_STATIC_ASSERT, except we don't define an empty
171
+ * fallback if we can't find an implementation; instead we have to
172
+ * check if SIMDE_STATIC_ASSERT is defined before using it. */
173
+ #if !defined(__cplusplus) && \
174
+ ((defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \
175
+ HEDLEY_HAS_FEATURE(c_static_assert) || \
176
+ HEDLEY_GCC_VERSION_CHECK(6, 0, 0) || \
177
+ HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || defined(_Static_assert))
178
+ #define SIMDE_STATIC_ASSERT(expr, message) _Static_assert(expr, message)
179
+ #elif (defined(__cplusplus) && (__cplusplus >= 201103L)) || \
180
+ HEDLEY_MSVC_VERSION_CHECK(16, 0, 0)
181
+ #define SIMDE_STATIC_ASSERT(expr, message) \
182
+ HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_( \
183
+ static_assert(expr, message))
184
+ #endif
185
+
186
+ #if (HEDLEY_HAS_ATTRIBUTE(may_alias) && !defined(HEDLEY_SUNPRO_VERSION)) || \
187
+ HEDLEY_GCC_VERSION_CHECK(3, 3, 0) || \
188
+ HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
189
+ HEDLEY_IBM_VERSION_CHECK(13, 1, 0)
190
+ #define SIMDE_MAY_ALIAS __attribute__((__may_alias__))
191
+ #else
192
+ #define SIMDE_MAY_ALIAS
193
+ #endif
194
+
195
+ /* Lots of compilers support GCC-style vector extensions, but many
196
+ don't support all the features. Define different macros depending
197
+ on support for
198
+
199
+ * SIMDE_VECTOR - Declaring a vector.
200
+ * SIMDE_VECTOR_OPS - basic operations (binary and unary).
201
+ * SIMDE_VECTOR_NEGATE - negating a vector
202
+ * SIMDE_VECTOR_SCALAR - For binary operators, the second argument
203
+ can be a scalar, in which case the result is as if that scalar
204
+ had been broadcast to all lanes of a vector.
205
+ * SIMDE_VECTOR_SUBSCRIPT - Supports array subscript notation for
206
+ extracting/inserting a single element.=
207
+
208
+ SIMDE_VECTOR can be assumed if any others are defined, the
209
+ others are independent. */
210
+ #if !defined(SIMDE_NO_VECTOR)
211
+ #if HEDLEY_GCC_VERSION_CHECK(4, 8, 0)
212
+ #define SIMDE_VECTOR(size) __attribute__((__vector_size__(size)))
213
+ #define SIMDE_VECTOR_OPS
214
+ #define SIMDE_VECTOR_NEGATE
215
+ #define SIMDE_VECTOR_SCALAR
216
+ #define SIMDE_VECTOR_SUBSCRIPT
217
+ #elif HEDLEY_INTEL_VERSION_CHECK(16, 0, 0)
218
+ #define SIMDE_VECTOR(size) __attribute__((__vector_size__(size)))
219
+ #define SIMDE_VECTOR_OPS
220
+ #define SIMDE_VECTOR_NEGATE
221
+ /* ICC only supports SIMDE_VECTOR_SCALAR for constants */
222
+ #define SIMDE_VECTOR_SUBSCRIPT
223
+ #elif HEDLEY_GCC_VERSION_CHECK(4, 1, 0) || HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
224
+ #define SIMDE_VECTOR(size) __attribute__((__vector_size__(size)))
225
+ #define SIMDE_VECTOR_OPS
226
+ #elif HEDLEY_SUNPRO_VERSION_CHECK(5, 12, 0)
227
+ #define SIMDE_VECTOR(size) __attribute__((__vector_size__(size)))
228
+ #elif HEDLEY_HAS_ATTRIBUTE(vector_size)
229
+ #define SIMDE_VECTOR(size) __attribute__((__vector_size__(size)))
230
+ #define SIMDE_VECTOR_OPS
231
+ #define SIMDE_VECTOR_NEGATE
232
+ #define SIMDE_VECTOR_SUBSCRIPT
233
+ #if SIMDE_DETECT_CLANG_VERSION_CHECK(5, 0, 0)
234
+ #define SIMDE_VECTOR_SCALAR
235
+ #endif
236
+ #endif
237
+
238
+ /* GCC and clang have built-in functions to handle shuffling and
239
+ converting of vectors, but the implementations are slightly
240
+ different. This macro is just an abstraction over them. Note that
241
+ elem_size is in bits but vec_size is in bytes. */
242
+ #if !defined(SIMDE_NO_SHUFFLE_VECTOR) && defined(SIMDE_VECTOR_SUBSCRIPT)
243
+ HEDLEY_DIAGNOSTIC_PUSH
244
+ /* We don't care about -Wvariadic-macros; all compilers that support
245
+ * shufflevector/shuffle support them. */
246
+ #if HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic")
247
+ #pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
248
+ #endif
249
+ #if HEDLEY_HAS_WARNING("-Wvariadic-macros") || HEDLEY_GCC_VERSION_CHECK(4, 0, 0)
250
+ #pragma GCC diagnostic ignored "-Wvariadic-macros"
251
+ #endif
252
+
253
+ #if HEDLEY_HAS_BUILTIN(__builtin_shufflevector)
254
+ #define SIMDE_SHUFFLE_VECTOR_(elem_size, vec_size, a, b, ...) \
255
+ __builtin_shufflevector(a, b, __VA_ARGS__)
256
+ #elif HEDLEY_GCC_HAS_BUILTIN(__builtin_shuffle, 4, 7, 0) && \
257
+ !defined(__INTEL_COMPILER)
258
+ #define SIMDE_SHUFFLE_VECTOR_(elem_size, vec_size, a, b, ...) \
259
+ (__extension__({ \
260
+ int##elem_size##_t SIMDE_VECTOR(vec_size) \
261
+ simde_shuffle_ = {__VA_ARGS__}; \
262
+ __builtin_shuffle(a, b, simde_shuffle_); \
263
+ }))
264
+ #endif
265
+ HEDLEY_DIAGNOSTIC_POP
266
+ #endif
267
+
268
+ /* TODO: this actually works on XL C/C++ without SIMDE_VECTOR_SUBSCRIPT
269
+ but the code needs to be refactored a bit to take advantage. */
270
+ #if !defined(SIMDE_NO_CONVERT_VECTOR) && defined(SIMDE_VECTOR_SUBSCRIPT)
271
+ #if HEDLEY_HAS_BUILTIN(__builtin_convertvector) || \
272
+ HEDLEY_GCC_VERSION_CHECK(9, 0, 0)
273
+ #if HEDLEY_GCC_VERSION_CHECK(9, 0, 0) && !HEDLEY_GCC_VERSION_CHECK(9, 3, 0)
274
+ /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93557 */
275
+ #define SIMDE_CONVERT_VECTOR_(to, from) \
276
+ ((to) = (__extension__({ \
277
+ __typeof__(from) from_ = (from); \
278
+ ((void)from_); \
279
+ __builtin_convertvector(from_, __typeof__(to)); \
280
+ })))
281
+ #else
282
+ #define SIMDE_CONVERT_VECTOR_(to, from) \
283
+ ((to) = __builtin_convertvector((from), __typeof__(to)))
284
+ #endif
285
+ #endif
286
+ #endif
287
+ #endif
288
+
289
+ /* Since we currently require SUBSCRIPT before using a vector in a
290
+ union, we define these as dependencies of SUBSCRIPT. They are
291
+ likely to disappear in the future, once SIMDe learns how to make
292
+ use of vectors without using the union members. Do not use them
293
+ in your code unless you're okay with it breaking when SIMDe
294
+ changes. */
295
+ #if defined(SIMDE_VECTOR_SUBSCRIPT)
296
+ #if defined(SIMDE_VECTOR_OPS)
297
+ #define SIMDE_VECTOR_SUBSCRIPT_OPS
298
+ #endif
299
+ #if defined(SIMDE_VECTOR_SCALAR)
300
+ #define SIMDE_VECTOR_SUBSCRIPT_SCALAR
301
+ #endif
302
+ #endif
303
+
304
+ #if !defined(SIMDE_ENABLE_OPENMP) && \
305
+ ((defined(_OPENMP) && (_OPENMP >= 201307L)) || \
306
+ (defined(_OPENMP_SIMD) && (_OPENMP_SIMD >= 201307L)))
307
+ #define SIMDE_ENABLE_OPENMP
308
+ #endif
309
+
310
+ #if !defined(SIMDE_ENABLE_CILKPLUS) && \
311
+ (defined(__cilk) || defined(HEDLEY_INTEL_VERSION))
312
+ #define SIMDE_ENABLE_CILKPLUS
313
+ #endif
314
+
315
+ #if defined(SIMDE_ENABLE_OPENMP)
316
+ #define SIMDE_VECTORIZE HEDLEY_PRAGMA(omp simd)
317
+ #define SIMDE_VECTORIZE_SAFELEN(l) HEDLEY_PRAGMA(omp simd safelen(l))
318
+ #if defined(__clang__)
319
+ #define SIMDE_VECTORIZE_REDUCTION(r) \
320
+ HEDLEY_DIAGNOSTIC_PUSH \
321
+ _Pragma("clang diagnostic ignored \"-Wsign-conversion\"") \
322
+ HEDLEY_PRAGMA(omp simd reduction(r)) HEDLEY_DIAGNOSTIC_POP
323
+ #else
324
+ #define SIMDE_VECTORIZE_REDUCTION(r) HEDLEY_PRAGMA(omp simd reduction(r))
325
+ #endif
326
+ #define SIMDE_VECTORIZE_ALIGNED(a) HEDLEY_PRAGMA(omp simd aligned(a))
327
+ #elif defined(SIMDE_ENABLE_CILKPLUS)
328
+ #define SIMDE_VECTORIZE HEDLEY_PRAGMA(simd)
329
+ #define SIMDE_VECTORIZE_SAFELEN(l) HEDLEY_PRAGMA(simd vectorlength(l))
330
+ #define SIMDE_VECTORIZE_REDUCTION(r) HEDLEY_PRAGMA(simd reduction(r))
331
+ #define SIMDE_VECTORIZE_ALIGNED(a) HEDLEY_PRAGMA(simd aligned(a))
332
+ #elif defined(__clang__) && !defined(HEDLEY_IBM_VERSION)
333
+ #define SIMDE_VECTORIZE HEDLEY_PRAGMA(clang loop vectorize(enable))
334
+ #define SIMDE_VECTORIZE_SAFELEN(l) HEDLEY_PRAGMA(clang loop vectorize_width(l))
335
+ #define SIMDE_VECTORIZE_REDUCTION(r) SIMDE_VECTORIZE
336
+ #define SIMDE_VECTORIZE_ALIGNED(a)
337
+ #elif HEDLEY_GCC_VERSION_CHECK(4, 9, 0)
338
+ #define SIMDE_VECTORIZE HEDLEY_PRAGMA(GCC ivdep)
339
+ #define SIMDE_VECTORIZE_SAFELEN(l) SIMDE_VECTORIZE
340
+ #define SIMDE_VECTORIZE_REDUCTION(r) SIMDE_VECTORIZE
341
+ #define SIMDE_VECTORIZE_ALIGNED(a)
342
+ #elif HEDLEY_CRAY_VERSION_CHECK(5, 0, 0)
343
+ #define SIMDE_VECTORIZE HEDLEY_PRAGMA(_CRI ivdep)
344
+ #define SIMDE_VECTORIZE_SAFELEN(l) SIMDE_VECTORIZE
345
+ #define SIMDE_VECTORIZE_REDUCTION(r) SIMDE_VECTORIZE
346
+ #define SIMDE_VECTORIZE_ALIGNED(a)
347
+ #else
348
+ #define SIMDE_VECTORIZE
349
+ #define SIMDE_VECTORIZE_SAFELEN(l)
350
+ #define SIMDE_VECTORIZE_REDUCTION(r)
351
+ #define SIMDE_VECTORIZE_ALIGNED(a)
352
+ #endif
353
+
354
+ #define SIMDE_MASK_NZ_(v, mask) (((v) & (mask)) | !((v) & (mask)))
355
+
356
+ /* Intended for checking coverage, you should never use this in
357
+ production. */
358
+ #if defined(SIMDE_NO_INLINE)
359
+ #define SIMDE_FUNCTION_ATTRIBUTES HEDLEY_NEVER_INLINE static
360
+ #else
361
+ #define SIMDE_FUNCTION_ATTRIBUTES HEDLEY_ALWAYS_INLINE static
362
+ #endif
363
+
364
+ #if HEDLEY_HAS_ATTRIBUTE(unused) || HEDLEY_GCC_VERSION_CHECK(2, 95, 0)
365
+ #define SIMDE_FUNCTION_POSSIBLY_UNUSED_ __attribute__((__unused__))
366
+ #else
367
+ #define SIMDE_FUNCTION_POSSIBLY_UNUSED_
368
+ #endif
369
+
370
+ #if HEDLEY_HAS_WARNING("-Wused-but-marked-unused")
371
+ #define SIMDE_DIAGNOSTIC_DISABLE_USED_BUT_MARKED_UNUSED \
372
+ _Pragma("clang diagnostic ignored \"-Wused-but-marked-unused\"")
373
+ #else
374
+ #define SIMDE_DIAGNOSTIC_DISABLE_USED_BUT_MARKED_UNUSED
375
+ #endif
376
+
377
+ #if defined(_MSC_VER)
378
+ #define SIMDE_BEGIN_DECLS_ \
379
+ HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(disable : 4996 4204)) \
380
+ HEDLEY_BEGIN_C_DECLS
381
+ #define SIMDE_END_DECLS_ HEDLEY_DIAGNOSTIC_POP HEDLEY_END_C_DECLS
382
+ #else
383
+ #define SIMDE_BEGIN_DECLS_ \
384
+ HEDLEY_DIAGNOSTIC_PUSH \
385
+ SIMDE_DIAGNOSTIC_DISABLE_USED_BUT_MARKED_UNUSED \
386
+ HEDLEY_BEGIN_C_DECLS
387
+ #define SIMDE_END_DECLS_ \
388
+ HEDLEY_END_C_DECLS \
389
+ HEDLEY_DIAGNOSTIC_POP
390
+ #endif
391
+
392
+ #if defined(__SIZEOF_INT128__)
393
+ #define SIMDE_HAVE_INT128_
394
+ HEDLEY_DIAGNOSTIC_PUSH
395
+ SIMDE_DIAGNOSTIC_DISABLE_PEDANTIC_
396
+ typedef __int128 simde_int128;
397
+ typedef unsigned __int128 simde_uint128;
398
+ HEDLEY_DIAGNOSTIC_POP
399
+ #endif
400
+
401
+ #if !defined(SIMDE_ENDIAN_LITTLE)
402
+ #define SIMDE_ENDIAN_LITTLE 1234
403
+ #endif
404
+ #if !defined(SIMDE_ENDIAN_BIG)
405
+ #define SIMDE_ENDIAN_BIG 4321
406
+ #endif
407
+
408
+ #if !defined(SIMDE_ENDIAN_ORDER)
409
+ /* GCC (and compilers masquerading as GCC) define __BYTE_ORDER__. */
410
+ #if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
411
+ (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
412
+ #define SIMDE_ENDIAN_ORDER SIMDE_ENDIAN_LITTLE
413
+ #elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \
414
+ (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
415
+ #define SIMDE_ENDIAN_ORDER SIMDE_ENDIAN_BIG
416
+ /* TI defines _BIG_ENDIAN or _LITTLE_ENDIAN */
417
+ #elif defined(_BIG_ENDIAN)
418
+ #define SIMDE_ENDIAN_ORDER SIMDE_ENDIAN_BIG
419
+ #elif defined(_LITTLE_ENDIAN)
420
+ #define SIMDE_ENDIAN_ORDER SIMDE_ENDIAN_LITTLE
421
+ /* We know the endianness of some common architectures. Common
422
+ * architectures not listed (ARM, POWER, MIPS, etc.) here are
423
+ * bi-endian. */
424
+ #elif defined(__amd64) || defined(_M_X64) || defined(__i386) || defined(_M_IX86)
425
+ #define SIMDE_ENDIAN_ORDER SIMDE_ENDIAN_LITTLE
426
+ #elif defined(__s390x__) || defined(__zarch__)
427
+ #define SIMDE_ENDIAN_ORDER SIMDE_ENDIAN_BIG
428
+ /* Looks like we'll have to rely on the platform. If we're missing a
429
+ * platform, please let us know. */
430
+ #elif defined(_WIN32)
431
+ #define SIMDE_ENDIAN_ORDER SIMDE_ENDIAN_LITTLE
432
+ #elif defined(sun) || defined(__sun) /* Solaris */
433
+ #include <sys/byteorder.h>
434
+ #if defined(_LITTLE_ENDIAN)
435
+ #define SIMDE_ENDIAN_ORDER SIMDE_ENDIAN_LITTLE
436
+ #elif defined(_BIG_ENDIAN)
437
+ #define SIMDE_ENDIAN_ORDER SIMDE_ENDIAN_BIG
438
+ #endif
439
+ #elif defined(__APPLE__)
440
+ #include <libkern/OSByteOrder.h>
441
+ #if defined(__LITTLE_ENDIAN__)
442
+ #define SIMDE_ENDIAN_ORDER SIMDE_ENDIAN_LITTLE
443
+ #elif defined(__BIG_ENDIAN__)
444
+ #define SIMDE_ENDIAN_ORDER SIMDE_ENDIAN_BIG
445
+ #endif
446
+ #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
447
+ defined(__bsdi__) || defined(__DragonFly__) || defined(BSD)
448
+ #include <machine/endian.h>
449
+ #if defined(__BYTE_ORDER) && (__BYTE_ORDER == __LITTLE_ENDIAN)
450
+ #define SIMDE_ENDIAN_ORDER SIMDE_ENDIAN_LITTLE
451
+ #elif defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)
452
+ #define SIMDE_ENDIAN_ORDER SIMDE_ENDIAN_BIG
453
+ #endif
454
+ #elif defined(__linux__) || defined(__linux) || defined(__gnu_linux__)
455
+ #include <endian.h>
456
+ #if defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && \
457
+ (__BYTE_ORDER == __LITTLE_ENDIAN)
458
+ #define SIMDE_ENDIAN_ORDER SIMDE_ENDIAN_LITTLE
459
+ #elif defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && \
460
+ (__BYTE_ORDER == __BIG_ENDIAN)
461
+ #define SIMDE_ENDIAN_ORDER SIMDE_ENDIAN_BIG
462
+ #endif
463
+ #endif
464
+ #endif
465
+
466
+ #if HEDLEY_HAS_BUILTIN(__builtin_bswap64) || \
467
+ HEDLEY_GCC_VERSION_CHECK(4, 3, 0) || \
468
+ HEDLEY_IBM_VERSION_CHECK(13, 1, 0) || \
469
+ HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
470
+ #define simde_bswap64(v) __builtin_bswap64(v)
471
+ #elif HEDLEY_MSVC_VERSION_CHECK(13, 10, 0)
472
+ #define simde_bswap64(v) _byteswap_uint64(v)
473
+ #else
474
+ SIMDE_FUNCTION_ATTRIBUTES
475
+ uint64_t simde_bswap64(uint64_t v)
476
+ {
477
+ return ((v & (((uint64_t)0xff) << 56)) >> 56) |
478
+ ((v & (((uint64_t)0xff) << 48)) >> 40) |
479
+ ((v & (((uint64_t)0xff) << 40)) >> 24) |
480
+ ((v & (((uint64_t)0xff) << 32)) >> 8) |
481
+ ((v & (((uint64_t)0xff) << 24)) << 8) |
482
+ ((v & (((uint64_t)0xff) << 16)) << 24) |
483
+ ((v & (((uint64_t)0xff) << 8)) << 40) |
484
+ ((v & (((uint64_t)0xff))) << 56);
485
+ }
486
+ #endif
487
+
488
+ #if !defined(SIMDE_ENDIAN_ORDER)
489
+ #error Unknown byte order; please file a bug
490
+ #else
491
+ #if SIMDE_ENDIAN_ORDER == SIMDE_ENDIAN_LITTLE
492
+ #define simde_endian_bswap64_be(value) simde_bswap64(value)
493
+ #define simde_endian_bswap64_le(value) (value)
494
+ #elif SIMDE_ENDIAN_ORDER == SIMDE_ENDIAN_BIG
495
+ #define simde_endian_bswap64_be(value) (value)
496
+ #define simde_endian_bswap64_le(value) simde_bswap64(value)
497
+ #endif
498
+ #endif
499
+
500
+ /* TODO: we should at least make an attempt to detect the correct
501
+ types for simde_float32/float64 instead of just assuming float and
502
+ double. */
503
+
504
+ #if !defined(SIMDE_FLOAT32_TYPE)
505
+ #define SIMDE_FLOAT32_TYPE float
506
+ #define SIMDE_FLOAT32_C(value) value##f
507
+ #else
508
+ #define SIMDE_FLOAT32_C(value) ((SIMDE_FLOAT32_TYPE)value)
509
+ #endif
510
+ typedef SIMDE_FLOAT32_TYPE simde_float32;
511
+
512
+ #if !defined(SIMDE_FLOAT64_TYPE)
513
+ #define SIMDE_FLOAT64_TYPE double
514
+ #define SIMDE_FLOAT64_C(value) value
515
+ #else
516
+ #define SIMDE_FLOAT32_C(value) ((SIMDE_FLOAT64_TYPE)value)
517
+ #endif
518
+ typedef SIMDE_FLOAT64_TYPE simde_float64;
519
+
520
+ #if HEDLEY_HAS_WARNING("-Wbad-function-cast")
521
+ #define SIMDE_CONVERT_FTOI(T, v) \
522
+ HEDLEY_DIAGNOSTIC_PUSH \
523
+ _Pragma("clang diagnostic ignored \"-Wbad-function-cast\"") \
524
+ HEDLEY_STATIC_CAST(T, (v)) HEDLEY_DIAGNOSTIC_POP
525
+ #else
526
+ #define SIMDE_CONVERT_FTOI(T, v) ((T)(v))
527
+ #endif
528
+
529
+ /* TODO: detect compilers which support this outside of C11 mode */
530
+ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
531
+ #define SIMDE_CHECKED_REINTERPRET_CAST(to, from, value) \
532
+ _Generic((value), to \
533
+ : (value), default \
534
+ : (_Generic((value), from \
535
+ : ((to)(value)))))
536
+ #define SIMDE_CHECKED_STATIC_CAST(to, from, value) \
537
+ _Generic((value), to \
538
+ : (value), default \
539
+ : (_Generic((value), from \
540
+ : ((to)(value)))))
541
+ #else
542
+ #define SIMDE_CHECKED_REINTERPRET_CAST(to, from, value) \
543
+ HEDLEY_REINTERPRET_CAST(to, value)
544
+ #define SIMDE_CHECKED_STATIC_CAST(to, from, value) HEDLEY_STATIC_CAST(to, value)
545
+ #endif
546
+
547
+ #if HEDLEY_HAS_WARNING("-Wfloat-equal")
548
+ #define SIMDE_DIAGNOSTIC_DISABLE_FLOAT_EQUAL \
549
+ _Pragma("clang diagnostic ignored \"-Wfloat-equal\"")
550
+ #elif HEDLEY_GCC_VERSION_CHECK(3, 0, 0)
551
+ #define SIMDE_DIAGNOSTIC_DISABLE_FLOAT_EQUAL \
552
+ _Pragma("GCC diagnostic ignored \"-Wfloat-equal\"")
553
+ #else
554
+ #define SIMDE_DIAGNOSTIC_DISABLE_FLOAT_EQUAL
555
+ #endif
556
+
557
+ /* Some functions can trade accuracy for speed. For those functions
558
+ you can control the trade-off using this macro. Possible values:
559
+
560
+ 0: prefer speed
561
+ 1: reasonable trade-offs
562
+ 2: prefer accuracy */
563
+ #if !defined(SIMDE_ACCURACY_PREFERENCE)
564
+ #define SIMDE_ACCURACY_PREFERENCE 1
565
+ #endif
566
+
567
+ #if defined(__STDC_HOSTED__)
568
+ #define SIMDE_STDC_HOSTED __STDC_HOSTED__
569
+ #else
570
+ #if defined(HEDLEY_PGI_VERSION) || defined(HEDLEY_MSVC_VERSION)
571
+ #define SIMDE_STDC_HOSTED 1
572
+ #else
573
+ #define SIMDE_STDC_HOSTED 0
574
+ #endif
575
+ #endif
576
+
577
+ /* Try to deal with environments without a standard library. */
578
+ #if !defined(simde_memcpy)
579
+ #if HEDLEY_HAS_BUILTIN(__builtin_memcpy)
580
+ #define simde_memcpy(dest, src, n) __builtin_memcpy(dest, src, n)
581
+ #endif
582
+ #endif
583
+ #if !defined(simde_memset)
584
+ #if HEDLEY_HAS_BUILTIN(__builtin_memset)
585
+ #define simde_memset(s, c, n) __builtin_memset(s, c, n)
586
+ #endif
587
+ #endif
588
+ #if !defined(simde_memcmp)
589
+ #if HEDLEY_HAS_BUILTIN(__builtin_memcmp)
590
+ #define simde_memcmp(s1, s2, n) __builtin_memcmp(s1, s2, n)
591
+ #endif
592
+ #endif
593
+
594
+ #if !defined(simde_memcpy) || !defined(simde_memset) || !defined(simde_memcmp)
595
+ #if !defined(SIMDE_NO_STRING_H)
596
+ #if defined(__has_include)
597
+ #if !__has_include(<string.h>)
598
+ #define SIMDE_NO_STRING_H
599
+ #endif
600
+ #elif (SIMDE_STDC_HOSTED == 0)
601
+ #define SIMDE_NO_STRING_H
602
+ #endif
603
+ #endif
604
+
605
+ #if !defined(SIMDE_NO_STRING_H)
606
+ #include <string.h>
607
+ #if !defined(simde_memcpy)
608
+ #define simde_memcpy(dest, src, n) memcpy(dest, src, n)
609
+ #endif
610
+ #if !defined(simde_memset)
611
+ #define simde_memset(s, c, n) memset(s, c, n)
612
+ #endif
613
+ #if !defined(simde_memcmp)
614
+ #define simde_memcmp(s1, s2, n) memcmp(s1, s2, n)
615
+ #endif
616
+ #else
617
+ /* These are meant to be portable, not fast. If you're hitting them you
618
+ * should think about providing your own (by defining the simde_memcpy
619
+ * macro prior to including any SIMDe files) or submitting a patch to
620
+ * SIMDe so we can detect your system-provided memcpy/memset, like by
621
+ * adding your compiler to the checks for __builtin_memcpy and/or
622
+ * __builtin_memset. */
623
+ #if !defined(simde_memcpy)
624
+ SIMDE_FUNCTION_ATTRIBUTES
625
+ void simde_memcpy_(void *dest, const void *src, size_t len)
626
+ {
627
+ char *dest_ = HEDLEY_STATIC_CAST(char *, dest);
628
+ char *src_ = HEDLEY_STATIC_CAST(const char *, src);
629
+ for (size_t i = 0; i < len; i++) {
630
+ dest_[i] = src_[i];
631
+ }
632
+ }
633
+ #define simde_memcpy(dest, src, n) simde_memcpy_(dest, src, n)
634
+ #endif
635
+
636
+ #if !defined(simde_memset)
637
+ SIMDE_FUNCTION_ATTRIBUTES
638
+ void simde_memset_(void *s, int c, size_t len)
639
+ {
640
+ char *s_ = HEDLEY_STATIC_CAST(char *, s);
641
+ char c_ = HEDLEY_STATIC_CAST(char, c);
642
+ for (size_t i = 0; i < len; i++) {
643
+ s_[i] = c_[i];
644
+ }
645
+ }
646
+ #define simde_memset(s, c, n) simde_memset_(s, c, n)
647
+ #endif
648
+
649
+ #if !defined(simde_memcmp)
650
+ SIMDE_FUCTION_ATTRIBUTES
651
+ int simde_memcmp_(const void *s1, const void *s2, size_t n)
652
+ {
653
+ unsigned char *s1_ = HEDLEY_STATIC_CAST(unsigned char *, s1);
654
+ unsigned char *s2_ = HEDLEY_STATIC_CAST(unsigned char *, s2);
655
+ for (size_t i = 0; i < len; i++) {
656
+ if (s1_[i] != s2_[i]) {
657
+ return (int)(s1_[i] - s2_[i]);
658
+ }
659
+ }
660
+ return 0;
661
+ }
662
+ #define simde_memcmp(s1, s2, n) simde_memcmp_(s1, s2, n)
663
+ #endif
664
+ #endif
665
+ #endif
666
+
667
+ #if defined(FE_ALL_EXCEPT)
668
+ #define SIMDE_HAVE_FENV_H
669
+ #elif defined(__has_include)
670
+ #if __has_include(<fenv.h>)
671
+ #include <fenv.h>
672
+ #define SIMDE_HAVE_FENV_H
673
+ #endif
674
+ #elif SIMDE_STDC_HOSTED == 1
675
+ #include <fenv.h>
676
+ #define SIMDE_HAVE_FENV_H
677
+ #endif
678
+
679
+ #if defined(EXIT_FAILURE)
680
+ #define SIMDE_HAVE_STDLIB_H
681
+ #elif defined(__has_include)
682
+ #if __has_include(<stdlib.h>)
683
+ #include <stdlib.h>
684
+ #define SIMDE_HAVE_STDLIB_H
685
+ #endif
686
+ #elif SIMDE_STDC_HOSTED == 1
687
+ #include <stdlib.h>
688
+ #define SIMDE_HAVE_STDLIB_H
689
+ #endif
690
+
691
+ #if defined(__has_include)
692
+ #if defined(__cplusplus) && (__cplusplus >= 201103L) && __has_include(<cfenv>)
693
+ #include <cfenv>
694
+ #elif __has_include(<fenv.h>)
695
+ #include <fenv.h>
696
+ #endif
697
+ #if __has_include(<stdlib.h>)
698
+ #include <stdlib.h>
699
+ #endif
700
+ #elif SIMDE_STDC_HOSTED == 1
701
+ #include <stdlib.h>
702
+ #include <fenv.h>
703
+ #endif
704
+
705
+ #include "check.h"
706
+
707
+ /* GCC/clang have a bunch of functionality in builtins which we would
708
+ * like to access, but the suffixes indicate whether the operate on
709
+ * int, long, or long long, not fixed width types (e.g., int32_t).
710
+ * we use these macros to attempt to map from fixed-width to the
711
+ * names GCC uses. Note that you should still cast the input(s) and
712
+ * return values (to/from SIMDE_BUILTIN_TYPE_*_) since often even if
713
+ * types are the same size they may not be compatible according to the
714
+ * compiler. For example, on x86 long and long lonsg are generally
715
+ * both 64 bits, but platforms vary on whether an int64_t is mapped
716
+ * to a long or long long. */
717
+
718
+ #include <limits.h>
719
+
720
+ HEDLEY_DIAGNOSTIC_PUSH
721
+ SIMDE_DIAGNOSTIC_DISABLE_CPP98_COMPAT_PEDANTIC_
722
+
723
+ #if (INT8_MAX == INT_MAX) && (INT8_MIN == INT_MIN)
724
+ #define SIMDE_BUILTIN_SUFFIX_8_
725
+ #define SIMDE_BUILTIN_TYPE_8_ int
726
+ #elif (INT8_MAX == LONG_MAX) && (INT8_MIN == LONG_MIN)
727
+ #define SIMDE_BUILTIN_SUFFIX_8_ l
728
+ #define SIMDE_BUILTIN_TYPE_8_ long
729
+ #elif (INT8_MAX == LLONG_MAX) && (INT8_MIN == LLONG_MIN)
730
+ #define SIMDE_BUILTIN_SUFFIX_8_ ll
731
+ #define SIMDE_BUILTIN_TYPE_8_ long long
732
+ #endif
733
+
734
+ #if (INT16_MAX == INT_MAX) && (INT16_MIN == INT_MIN)
735
+ #define SIMDE_BUILTIN_SUFFIX_16_
736
+ #define SIMDE_BUILTIN_TYPE_16_ int
737
+ #elif (INT16_MAX == LONG_MAX) && (INT16_MIN == LONG_MIN)
738
+ #define SIMDE_BUILTIN_SUFFIX_16_ l
739
+ #define SIMDE_BUILTIN_TYPE_16_ long
740
+ #elif (INT16_MAX == LLONG_MAX) && (INT16_MIN == LLONG_MIN)
741
+ #define SIMDE_BUILTIN_SUFFIX_16_ ll
742
+ #define SIMDE_BUILTIN_TYPE_16_ long long
743
+ #endif
744
+
745
+ #if (INT32_MAX == INT_MAX) && (INT32_MIN == INT_MIN)
746
+ #define SIMDE_BUILTIN_SUFFIX_32_
747
+ #define SIMDE_BUILTIN_TYPE_32_ int
748
+ #elif (INT32_MAX == LONG_MAX) && (INT32_MIN == LONG_MIN)
749
+ #define SIMDE_BUILTIN_SUFFIX_32_ l
750
+ #define SIMDE_BUILTIN_TYPE_32_ long
751
+ #elif (INT32_MAX == LLONG_MAX) && (INT32_MIN == LLONG_MIN)
752
+ #define SIMDE_BUILTIN_SUFFIX_32_ ll
753
+ #define SIMDE_BUILTIN_TYPE_32_ long long
754
+ #endif
755
+
756
+ #if (INT64_MAX == INT_MAX) && (INT64_MIN == INT_MIN)
757
+ #define SIMDE_BUILTIN_SUFFIX_64_
758
+ #define SIMDE_BUILTIN_TYPE_64_ int
759
+ #elif (INT64_MAX == LONG_MAX) && (INT64_MIN == LONG_MIN)
760
+ #define SIMDE_BUILTIN_SUFFIX_64_ l
761
+ #define SIMDE_BUILTIN_TYPE_64_ long
762
+ #elif (INT64_MAX == LLONG_MAX) && (INT64_MIN == LLONG_MIN)
763
+ #define SIMDE_BUILTIN_SUFFIX_64_ ll
764
+ #define SIMDE_BUILTIN_TYPE_64_ long long
765
+ #endif
766
+
767
+ #if defined(SIMDE_BUILTIN_SUFFIX_8_)
768
+ #define SIMDE_BUILTIN_8_(name) \
769
+ HEDLEY_CONCAT3(__builtin_, name, SIMDE_BUILTIN_SUFFIX_8_)
770
+ #define SIMDE_BUILTIN_HAS_8_(name) \
771
+ HEDLEY_HAS_BUILTIN( \
772
+ HEDLEY_CONCAT3(__builtin_, name, SIMDE_BUILTIN_SUFFIX_8_))
773
+ #else
774
+ #define SIMDE_BUILTIN_HAS_8_(name) 0
775
+ #endif
776
+ #if defined(SIMDE_BUILTIN_SUFFIX_16_)
777
+ #define SIMDE_BUILTIN_16_(name) \
778
+ HEDLEY_CONCAT3(__builtin_, name, SIMDE_BUILTIN_SUFFIX_16_)
779
+ #define SIMDE_BUILTIN_HAS_16_(name) \
780
+ HEDLEY_HAS_BUILTIN( \
781
+ HEDLEY_CONCAT3(__builtin_, name, SIMDE_BUILTIN_SUFFIX_16_))
782
+ #else
783
+ #define SIMDE_BUILTIN_HAS_16_(name) 0
784
+ #endif
785
+ #if defined(SIMDE_BUILTIN_SUFFIX_32_)
786
+ #define SIMDE_BUILTIN_32_(name) \
787
+ HEDLEY_CONCAT3(__builtin_, name, SIMDE_BUILTIN_SUFFIX_32_)
788
+ #define SIMDE_BUILTIN_HAS_32_(name) \
789
+ HEDLEY_HAS_BUILTIN( \
790
+ HEDLEY_CONCAT3(__builtin_, name, SIMDE_BUILTIN_SUFFIX_32_))
791
+ #else
792
+ #define SIMDE_BUILTIN_HAS_32_(name) 0
793
+ #endif
794
+ #if defined(SIMDE_BUILTIN_SUFFIX_64_)
795
+ #define SIMDE_BUILTIN_64_(name) \
796
+ HEDLEY_CONCAT3(__builtin_, name, SIMDE_BUILTIN_SUFFIX_64_)
797
+ #define SIMDE_BUILTIN_HAS_64_(name) \
798
+ HEDLEY_HAS_BUILTIN( \
799
+ HEDLEY_CONCAT3(__builtin_, name, SIMDE_BUILTIN_SUFFIX_64_))
800
+ #else
801
+ #define SIMDE_BUILTIN_HAS_64_(name) 0
802
+ #endif
803
+
804
+ HEDLEY_DIAGNOSTIC_POP
805
+
806
+ /* Sometimes we run into problems with specific versions of compilers
807
+ which make the native versions unusable for us. Often this is due
808
+ to missing functions, sometimes buggy implementations, etc. These
809
+ macros are how we check for specific bugs. As they are fixed we'll
810
+ start only defining them for problematic compiler versions. */
811
+
812
+ #if !defined(SIMDE_IGNORE_COMPILER_BUGS)
813
+ #if defined(HEDLEY_GCC_VERSION)
814
+ #if !HEDLEY_GCC_VERSION_CHECK(4, 9, 0)
815
+ #define SIMDE_BUG_GCC_REV_208793
816
+ #endif
817
+ #if !HEDLEY_GCC_VERSION_CHECK(5, 0, 0)
818
+ #define SIMDE_BUG_GCC_BAD_MM_SRA_EPI32 /* TODO: find relevant bug or commit */
819
+ #endif
820
+ #if !HEDLEY_GCC_VERSION_CHECK(4, 6, 0)
821
+ #define SIMDE_BUG_GCC_BAD_MM_EXTRACT_EPI8 /* TODO: find relevant bug or commit */
822
+ #endif
823
+ #if !HEDLEY_GCC_VERSION_CHECK(8, 0, 0)
824
+ #define SIMDE_BUG_GCC_REV_247851
825
+ #endif
826
+ #if !HEDLEY_GCC_VERSION_CHECK(10, 0, 0)
827
+ #define SIMDE_BUG_GCC_REV_274313
828
+ #define SIMDE_BUG_GCC_91341
829
+ #endif
830
+ #if !HEDLEY_GCC_VERSION_CHECK(9, 0, 0) && defined(SIMDE_ARCH_AARCH64)
831
+ #define SIMDE_BUG_GCC_ARM_SHIFT_SCALAR
832
+ #endif
833
+ #if defined(SIMDE_ARCH_X86) && !defined(SIMDE_ARCH_AMD64)
834
+ #define SIMDE_BUG_GCC_94482
835
+ #endif
836
+ #if (defined(SIMDE_ARCH_X86) && !defined(SIMDE_ARCH_AMD64)) || \
837
+ defined(SIMDE_ARCH_SYSTEMZ)
838
+ #define SIMDE_BUG_GCC_53784
839
+ #endif
840
+ #if defined(SIMDE_ARCH_X86) || defined(SIMDE_ARCH_AMD64)
841
+ #if HEDLEY_GCC_VERSION_CHECK(4, 3, 0) /* -Wsign-conversion */
842
+ #define SIMDE_BUG_GCC_95144
843
+ #endif
844
+ #endif
845
+ #if !HEDLEY_GCC_VERSION_CHECK(9, 4, 0) && defined(SIMDE_ARCH_AARCH64)
846
+ #define SIMDE_BUG_GCC_94488
847
+ #endif
848
+ #if defined(SIMDE_ARCH_ARM)
849
+ #define SIMDE_BUG_GCC_95399
850
+ #define SIMDE_BUG_GCC_95471
851
+ #elif defined(SIMDE_ARCH_POWER)
852
+ #define SIMDE_BUG_GCC_95227
853
+ #define SIMDE_BUG_GCC_95782
854
+ #elif defined(SIMDE_ARCH_X86) || defined(SIMDE_ARCH_AMD64)
855
+ #if !HEDLEY_GCC_VERSION_CHECK(10, 2, 0) && !defined(__OPTIMIZE__)
856
+ #define SIMDE_BUG_GCC_96174
857
+ #endif
858
+ #endif
859
+ #define SIMDE_BUG_GCC_95399
860
+ #elif defined(__clang__)
861
+ #if defined(SIMDE_ARCH_AARCH64)
862
+ #define SIMDE_BUG_CLANG_45541
863
+ #define SIMDE_BUG_CLANG_46844
864
+ #define SIMDE_BUG_CLANG_48257
865
+ #if SIMDE_DETECT_CLANG_VERSION_CHECK(10, 0, 0) && \
866
+ SIMDE_DETECT_CLANG_VERSION_NOT(11, 0, 0)
867
+ #define SIMDE_BUG_CLANG_BAD_VI64_OPS
868
+ #endif
869
+ #endif
870
+ #if defined(SIMDE_ARCH_POWER)
871
+ #define SIMDE_BUG_CLANG_46770
872
+ #endif
873
+ #if defined(_ARCH_PWR9) && !SIMDE_DETECT_CLANG_VERSION_CHECK(12, 0, 0) && \
874
+ !defined(__OPTIMIZE__)
875
+ #define SIMDE_BUG_CLANG_POWER9_16x4_BAD_SHIFT
876
+ #endif
877
+ #if defined(SIMDE_ARCH_X86) || defined(SIMDE_ARCH_AMD64)
878
+ #if HEDLEY_HAS_WARNING("-Wsign-conversion") && \
879
+ SIMDE_DETECT_CLANG_VERSION_NOT(11, 0, 0)
880
+ #define SIMDE_BUG_CLANG_45931
881
+ #endif
882
+ #if HEDLEY_HAS_WARNING("-Wvector-conversion") && \
883
+ SIMDE_DETECT_CLANG_VERSION_NOT(11, 0, 0)
884
+ #define SIMDE_BUG_CLANG_44589
885
+ #endif
886
+ #endif
887
+ #define SIMDE_BUG_CLANG_45959
888
+ #elif defined(HEDLEY_MSVC_VERSION)
889
+ #if defined(SIMDE_ARCH_X86)
890
+ #define SIMDE_BUG_MSVC_ROUND_EXTRACT
891
+ #endif
892
+ #elif defined(HEDLEY_INTEL_VERSION)
893
+ #define SIMDE_BUG_INTEL_857088
894
+ #endif
895
+ #endif
896
+
897
+ /* GCC and Clang both have the same issue:
898
+ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95144
899
+ * https://bugs.llvm.org/show_bug.cgi?id=45931
900
+ * This is just an easy way to work around it.
901
+ */
902
+ #if (HEDLEY_HAS_WARNING("-Wsign-conversion") && \
903
+ SIMDE_DETECT_CLANG_VERSION_NOT(11, 0, 0)) || \
904
+ HEDLEY_GCC_VERSION_CHECK(4, 3, 0)
905
+ #define SIMDE_BUG_IGNORE_SIGN_CONVERSION(expr) \
906
+ (__extension__({ \
907
+ HEDLEY_DIAGNOSTIC_PUSH \
908
+ HEDLEY_DIAGNOSTIC_POP \
909
+ _Pragma("GCC diagnostic ignored \"-Wsign-conversion\"") __typeof__(expr) \
910
+ simde_bug_ignore_sign_conversion_v_ = (expr); \
911
+ HEDLEY_DIAGNOSTIC_PUSH \
912
+ simde_bug_ignore_sign_conversion_v_; \
913
+ }))
914
+ #else
915
+ #define SIMDE_BUG_IGNORE_SIGN_CONVERSION(expr) (expr)
916
+ #endif
917
+
918
+ #endif /* !defined(SIMDE_COMMON_H) */