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,481 @@
1
+ /* Alignment
2
+ * Created by Evan Nemerson <evan@nemerson.com>
3
+ *
4
+ * To the extent possible under law, the authors have waived all
5
+ * copyright and related or neighboring rights to this code. For
6
+ * details, see the Creative Commons Zero 1.0 Universal license at
7
+ * <https://creativecommons.org/publicdomain/zero/1.0/>
8
+ *
9
+ * SPDX-License-Identifier: CC0-1.0
10
+ *
11
+ **********************************************************************
12
+ *
13
+ * This is portability layer which should help iron out some
14
+ * differences across various compilers, as well as various verisons of
15
+ * C and C++.
16
+ *
17
+ * It was originally developed for SIMD Everywhere
18
+ * (<https://github.com/simd-everywhere/simde>), but since its only
19
+ * dependency is Hedley (<https://nemequ.github.io/hedley>, also CC0)
20
+ * it can easily be used in other projects, so please feel free to do
21
+ * so.
22
+ *
23
+ * If you do use this in your project, please keep a link to SIMDe in
24
+ * your code to remind you where to report any bugs and/or check for
25
+ * updated versions.
26
+ *
27
+ * # API Overview
28
+ *
29
+ * The API has several parts, and most macros have a few variations.
30
+ * There are APIs for declaring aligned fields/variables, optimization
31
+ * hints, and run-time alignment checks.
32
+ *
33
+ * Briefly, macros ending with "_TO" take numeric values and are great
34
+ * when you know the value you would like to use. Macros ending with
35
+ * "_LIKE", on the other hand, accept a type and are used when you want
36
+ * to use the alignment of a type instead of hardcoding a value.
37
+ *
38
+ * Documentation for each section of the API is inline.
39
+ *
40
+ * True to form, MSVC is the main problem and imposes several
41
+ * limitations on the effectiveness of the APIs. Detailed descriptions
42
+ * of the limitations of each macro are inline, but in general:
43
+ *
44
+ * * On C11+ or C++11+ code written using this API will work. The
45
+ * ASSUME macros may or may not generate a hint to the compiler, but
46
+ * that is only an optimization issue and will not actually cause
47
+ * failures.
48
+ * * If you're using pretty much any compiler other than MSVC,
49
+ * everything should basically work as well as in C11/C++11.
50
+ */
51
+
52
+ #if !defined(SIMDE_ALIGN_H)
53
+ #define SIMDE_ALIGN_H
54
+
55
+ #include "hedley.h"
56
+
57
+ /* I know this seems a little silly, but some non-hosted compilers
58
+ * don't have stddef.h, so we try to accomodate them. */
59
+ #if !defined(SIMDE_ALIGN_SIZE_T_)
60
+ #if defined(__SIZE_TYPE__)
61
+ #define SIMDE_ALIGN_SIZE_T_ __SIZE_TYPE__
62
+ #elif defined(__SIZE_T_TYPE__)
63
+ #define SIMDE_ALIGN_SIZE_T_ __SIZE_TYPE__
64
+ #elif defined(__cplusplus)
65
+ #include <cstddef>
66
+ #define SIMDE_ALIGN_SIZE_T_ size_t
67
+ #else
68
+ #include <stddef.h>
69
+ #define SIMDE_ALIGN_SIZE_T_ size_t
70
+ #endif
71
+ #endif
72
+
73
+ #if !defined(SIMDE_ALIGN_INTPTR_T_)
74
+ #if defined(__INTPTR_TYPE__)
75
+ #define SIMDE_ALIGN_INTPTR_T_ __INTPTR_TYPE__
76
+ #elif defined(__PTRDIFF_TYPE__)
77
+ #define SIMDE_ALIGN_INTPTR_T_ __PTRDIFF_TYPE__
78
+ #elif defined(__PTRDIFF_T_TYPE__)
79
+ #define SIMDE_ALIGN_INTPTR_T_ __PTRDIFF_T_TYPE__
80
+ #elif defined(__cplusplus)
81
+ #include <cstddef>
82
+ #define SIMDE_ALIGN_INTPTR_T_ ptrdiff_t
83
+ #else
84
+ #include <stddef.h>
85
+ #define SIMDE_ALIGN_INTPTR_T_ ptrdiff_t
86
+ #endif
87
+ #endif
88
+
89
+ #if defined(SIMDE_ALIGN_DEBUG)
90
+ #if defined(__cplusplus)
91
+ #include <cstdio>
92
+ #else
93
+ #include <stdio.h>
94
+ #endif
95
+ #endif
96
+
97
+ /* SIMDE_ALIGN_OF(Type)
98
+ *
99
+ * The SIMDE_ALIGN_OF macro works like alignof, or _Alignof, or
100
+ * __alignof, or __alignof__, or __ALIGNOF__, depending on the compiler.
101
+ * It isn't defined everywhere (only when the compiler has some alignof-
102
+ * like feature we can use to implement it), but it should work in most
103
+ * modern compilers, as well as C11 and C++11.
104
+ *
105
+ * If we can't find an implementation for SIMDE_ALIGN_OF then the macro
106
+ * will not be defined, so if you can handle that situation sensibly
107
+ * you may need to sprinkle some ifdefs into your code.
108
+ */
109
+ #if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \
110
+ (0 && HEDLEY_HAS_FEATURE(c_alignof))
111
+ #define SIMDE_ALIGN_OF(Type) _Alignof(Type)
112
+ #elif (defined(__cplusplus) && (__cplusplus >= 201103L)) || \
113
+ (0 && HEDLEY_HAS_FEATURE(cxx_alignof))
114
+ #define SIMDE_ALIGN_OF(Type) alignof(Type)
115
+ #elif HEDLEY_GCC_VERSION_CHECK(2, 95, 0) || \
116
+ HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \
117
+ HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
118
+ HEDLEY_SUNPRO_VERSION_CHECK(5, 13, 0) || \
119
+ HEDLEY_TINYC_VERSION_CHECK(0, 9, 24) || \
120
+ HEDLEY_PGI_VERSION_CHECK(19, 10, 0) || \
121
+ HEDLEY_CRAY_VERSION_CHECK(10, 0, 0) || \
122
+ HEDLEY_TI_ARMCL_VERSION_CHECK(16, 9, 0) || \
123
+ HEDLEY_TI_CL2000_VERSION_CHECK(16, 9, 0) || \
124
+ HEDLEY_TI_CL6X_VERSION_CHECK(8, 0, 0) || \
125
+ HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
126
+ HEDLEY_TI_CL430_VERSION_CHECK(16, 9, 0) || \
127
+ HEDLEY_TI_CLPRU_VERSION_CHECK(2, 3, 2) || defined(__IBM__ALIGNOF__) || \
128
+ defined(__clang__)
129
+ #define SIMDE_ALIGN_OF(Type) __alignof__(Type)
130
+ #elif HEDLEY_IAR_VERSION_CHECK(8, 40, 0)
131
+ #define SIMDE_ALIGN_OF(Type) __ALIGNOF__(Type)
132
+ #elif HEDLEY_MSVC_VERSION_CHECK(19, 0, 0)
133
+ /* Probably goes back much further, but MS takes down their old docs.
134
+ * If you can verify that this works in earlier versions please let
135
+ * me know! */
136
+ #define SIMDE_ALIGN_OF(Type) __alignof(Type)
137
+ #endif
138
+
139
+ /* SIMDE_ALIGN_MAXIMUM:
140
+ *
141
+ * This is the maximum alignment that the compiler supports. You can
142
+ * define the value prior to including SIMDe if necessary, but in that
143
+ * case *please* submit an issue so we can add the platform to the
144
+ * detection code.
145
+ *
146
+ * Most compilers are okay with types which are aligned beyond what
147
+ * they think is the maximum, as long as the alignment is a power
148
+ * of two. MSVC is the exception (of course), so we need to cap the
149
+ * alignment requests at values that the implementation supports.
150
+ *
151
+ * XL C/C++ will accept values larger than 16 (which is the alignment
152
+ * of an AltiVec vector), but will not reliably align to the larger
153
+ * value, so so we cap the value at 16 there.
154
+ *
155
+ * If the compiler accepts any power-of-two value within reason then
156
+ * this macro should be left undefined, and the SIMDE_ALIGN_CAP
157
+ * macro will just return the value passed to it. */
158
+ #if !defined(SIMDE_ALIGN_MAXIMUM)
159
+ #if defined(HEDLEY_MSVC_VERSION)
160
+ #if defined(_M_IX86) || defined(_M_AMD64)
161
+ #if HEDLEY_MSVC_VERSION_CHECK(19, 14, 0)
162
+ #define SIMDE_ALIGN_PLATFORM_MAXIMUM 64
163
+ #elif HEDLEY_MSVC_VERSION_CHECK(16, 0, 0)
164
+ /* VS 2010 is really a guess based on Wikipedia; if anyone can
165
+ * test with old VS versions I'd really appreciate it. */
166
+ #define SIMDE_ALIGN_PLATFORM_MAXIMUM 32
167
+ #else
168
+ #define SIMDE_ALIGN_PLATFORM_MAXIMUM 16
169
+ #endif
170
+ #elif defined(_M_ARM) || defined(_M_ARM64)
171
+ #define SIMDE_ALIGN_PLATFORM_MAXIMUM 8
172
+ #endif
173
+ #elif defined(HEDLEY_IBM_VERSION)
174
+ #define SIMDE_ALIGN_PLATFORM_MAXIMUM 16
175
+ #endif
176
+ #endif
177
+
178
+ /* You can mostly ignore these; they're intended for internal use.
179
+ * If you do need to use them please let me know; if they fulfill
180
+ * a common use case I'll probably drop the trailing underscore
181
+ * and make them part of the public API. */
182
+ #if defined(SIMDE_ALIGN_PLATFORM_MAXIMUM)
183
+ #if SIMDE_ALIGN_PLATFORM_MAXIMUM >= 64
184
+ #define SIMDE_ALIGN_64_ 64
185
+ #define SIMDE_ALIGN_32_ 32
186
+ #define SIMDE_ALIGN_16_ 16
187
+ #define SIMDE_ALIGN_8_ 8
188
+ #elif SIMDE_ALIGN_PLATFORM_MAXIMUM >= 32
189
+ #define SIMDE_ALIGN_64_ 32
190
+ #define SIMDE_ALIGN_32_ 32
191
+ #define SIMDE_ALIGN_16_ 16
192
+ #define SIMDE_ALIGN_8_ 8
193
+ #elif SIMDE_ALIGN_PLATFORM_MAXIMUM >= 16
194
+ #define SIMDE_ALIGN_64_ 16
195
+ #define SIMDE_ALIGN_32_ 16
196
+ #define SIMDE_ALIGN_16_ 16
197
+ #define SIMDE_ALIGN_8_ 8
198
+ #elif SIMDE_ALIGN_PLATFORM_MAXIMUM >= 8
199
+ #define SIMDE_ALIGN_64_ 8
200
+ #define SIMDE_ALIGN_32_ 8
201
+ #define SIMDE_ALIGN_16_ 8
202
+ #define SIMDE_ALIGN_8_ 8
203
+ #else
204
+ #error Max alignment expected to be >= 8
205
+ #endif
206
+ #else
207
+ #define SIMDE_ALIGN_64_ 64
208
+ #define SIMDE_ALIGN_32_ 32
209
+ #define SIMDE_ALIGN_16_ 16
210
+ #define SIMDE_ALIGN_8_ 8
211
+ #endif
212
+
213
+ /**
214
+ * SIMDE_ALIGN_CAP(Alignment)
215
+ *
216
+ * Returns the minimum of Alignment or SIMDE_ALIGN_MAXIMUM.
217
+ */
218
+ #if defined(SIMDE_ALIGN_MAXIMUM)
219
+ #define SIMDE_ALIGN_CAP(Alignment) \
220
+ (((Alignment) < (SIMDE_ALIGN_PLATFORM_MAXIMUM)) \
221
+ ? (Alignment) \
222
+ : (SIMDE_ALIGN_PLATFORM_MAXIMUM))
223
+ #else
224
+ #define SIMDE_ALIGN_CAP(Alignment) (Alignment)
225
+ #endif
226
+
227
+ /* SIMDE_ALIGN_TO(Alignment)
228
+ *
229
+ * SIMDE_ALIGN_TO is used to declare types or variables. It basically
230
+ * maps to the align attribute in most compilers, the align declspec
231
+ * in MSVC, or _Alignas/alignas in C11/C++11.
232
+ *
233
+ * Example:
234
+ *
235
+ * struct i32x4 {
236
+ * SIMDE_ALIGN_TO(16) int32_t values[4];
237
+ * }
238
+ *
239
+ * Limitations:
240
+ *
241
+ * MSVC requires that the Alignment parameter be numeric; you can't do
242
+ * something like `SIMDE_ALIGN_TO(SIMDE_ALIGN_OF(int))`. This is
243
+ * unfortunate because that's really how the LIKE macros are
244
+ * implemented, and I am not aware of a way to get anything like this
245
+ * to work without using the C11/C++11 keywords.
246
+ *
247
+ * It also means that we can't use SIMDE_ALIGN_CAP to limit the
248
+ * alignment to the value specified, which MSVC also requires, so on
249
+ * MSVC you should use the `SIMDE_ALIGN_TO_8/16/32/64` macros instead.
250
+ * They work like `SIMDE_ALIGN_TO(SIMDE_ALIGN_CAP(Alignment))` would,
251
+ * but should be safe to use on MSVC.
252
+ *
253
+ * All this is to say that, if you want your code to work on MSVC, you
254
+ * should use the SIMDE_ALIGN_TO_8/16/32/64 macros below instead of
255
+ * SIMDE_ALIGN_TO(8/16/32/64).
256
+ */
257
+ #if HEDLEY_HAS_ATTRIBUTE(aligned) || HEDLEY_GCC_VERSION_CHECK(2, 95, 0) || \
258
+ HEDLEY_CRAY_VERSION_CHECK(8, 4, 0) || \
259
+ HEDLEY_IBM_VERSION_CHECK(11, 1, 0) || \
260
+ HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
261
+ HEDLEY_PGI_VERSION_CHECK(19, 4, 0) || \
262
+ HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \
263
+ HEDLEY_TINYC_VERSION_CHECK(0, 9, 24) || \
264
+ HEDLEY_TI_ARMCL_VERSION_CHECK(16, 9, 0) || \
265
+ HEDLEY_TI_CL2000_VERSION_CHECK(16, 9, 0) || \
266
+ HEDLEY_TI_CL6X_VERSION_CHECK(8, 0, 0) || \
267
+ HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
268
+ HEDLEY_TI_CL430_VERSION_CHECK(16, 9, 0) || \
269
+ HEDLEY_TI_CLPRU_VERSION_CHECK(2, 3, 2)
270
+ #define SIMDE_ALIGN_TO(Alignment) \
271
+ __attribute__((__aligned__(SIMDE_ALIGN_CAP(Alignment))))
272
+ #elif (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L))
273
+ #define SIMDE_ALIGN_TO(Alignment) _Alignas(SIMDE_ALIGN_CAP(Alignment))
274
+ #elif (defined(__cplusplus) && (__cplusplus >= 201103L))
275
+ #define SIMDE_ALIGN_TO(Alignment) alignas(SIMDE_ALIGN_CAP(Alignment))
276
+ #elif defined(HEDLEY_MSVC_VERSION)
277
+ #define SIMDE_ALIGN_TO(Alignment) __declspec(align(Alignment))
278
+ /* Unfortunately MSVC can't handle __declspec(align(__alignof(Type)));
279
+ * the alignment passed to the declspec has to be an integer. */
280
+ #define SIMDE_ALIGN_OF_UNUSABLE_FOR_LIKE
281
+ #endif
282
+ #define SIMDE_ALIGN_TO_64 SIMDE_ALIGN_TO(SIMDE_ALIGN_64_)
283
+ #define SIMDE_ALIGN_TO_32 SIMDE_ALIGN_TO(SIMDE_ALIGN_32_)
284
+ #define SIMDE_ALIGN_TO_16 SIMDE_ALIGN_TO(SIMDE_ALIGN_16_)
285
+ #define SIMDE_ALIGN_TO_8 SIMDE_ALIGN_TO(SIMDE_ALIGN_8_)
286
+
287
+ /* SIMDE_ALIGN_ASSUME_TO(Pointer, Alignment)
288
+ *
289
+ * SIMDE_ALIGN_ASSUME_TO is semantically similar to C++20's
290
+ * std::assume_aligned, or __builtin_assume_aligned. It tells the
291
+ * compiler to assume that the provided pointer is aligned to an
292
+ * `Alignment`-byte boundary.
293
+ *
294
+ * If you define SIMDE_ALIGN_DEBUG prior to including this header then
295
+ * SIMDE_ALIGN_ASSUME_TO will turn into a runtime check. We don't
296
+ * integrate with NDEBUG in this header, but it may be a good idea to
297
+ * put something like this in your code:
298
+ *
299
+ * #if !defined(NDEBUG)
300
+ * #define SIMDE_ALIGN_DEBUG
301
+ * #endif
302
+ * #include <.../simde-align.h>
303
+ */
304
+ #if HEDLEY_HAS_BUILTIN(__builtin_assume_aligned) || \
305
+ HEDLEY_GCC_VERSION_CHECK(4, 7, 0)
306
+ #define SIMDE_ALIGN_ASSUME_TO_UNCHECKED(Pointer, Alignment) \
307
+ HEDLEY_REINTERPRET_CAST( \
308
+ __typeof__(Pointer), \
309
+ __builtin_assume_aligned( \
310
+ HEDLEY_CONST_CAST( \
311
+ void *, HEDLEY_REINTERPRET_CAST(const void *, \
312
+ Pointer)), \
313
+ Alignment))
314
+ #elif HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
315
+ #define SIMDE_ALIGN_ASSUME_TO_UNCHECKED(Pointer, Alignment) \
316
+ (__extension__({ \
317
+ __typeof__(v) simde_assume_aligned_t_ = (Pointer); \
318
+ __assume_aligned(simde_assume_aligned_t_, Alignment); \
319
+ simde_assume_aligned_t_; \
320
+ }))
321
+ #elif defined(__cplusplus) && (__cplusplus > 201703L)
322
+ #include <memory>
323
+ #define SIMDE_ALIGN_ASSUME_TO_UNCHECKED(Pointer, Alignment) \
324
+ std::assume_aligned<Alignment>(Pointer)
325
+ #else
326
+ #if defined(__cplusplus)
327
+ template<typename T>
328
+ HEDLEY_ALWAYS_INLINE static T *
329
+ simde_align_assume_to_unchecked(T *ptr, const size_t alignment)
330
+ #else
331
+ HEDLEY_ALWAYS_INLINE static void *
332
+ simde_align_assume_to_unchecked(void *ptr, const size_t alignment)
333
+ #endif
334
+ {
335
+ HEDLEY_ASSUME((HEDLEY_REINTERPRET_CAST(size_t, (ptr)) %
336
+ SIMDE_ALIGN_CAP(alignment)) == 0);
337
+ return ptr;
338
+ }
339
+ #if defined(__cplusplus)
340
+ #define SIMDE_ALIGN_ASSUME_TO_UNCHECKED(Pointer, Alignment) \
341
+ simde_align_assume_to_unchecked((Pointer), (Alignment))
342
+ #else
343
+ #define SIMDE_ALIGN_ASSUME_TO_UNCHECKED(Pointer, Alignment) \
344
+ simde_align_assume_to_unchecked( \
345
+ HEDLEY_CONST_CAST(void *, HEDLEY_REINTERPRET_CAST( \
346
+ const void *, Pointer)), \
347
+ (Alignment))
348
+ #endif
349
+ #endif
350
+
351
+ #if !defined(SIMDE_ALIGN_DEBUG)
352
+ #define SIMDE_ALIGN_ASSUME_TO(Pointer, Alignment) \
353
+ SIMDE_ALIGN_ASSUME_TO_UNCHECKED(Pointer, Alignment)
354
+ #else
355
+ #include <stdio.h>
356
+ #if defined(__cplusplus)
357
+ template<typename T>
358
+ static HEDLEY_ALWAYS_INLINE T *
359
+ simde_align_assume_to_checked_uncapped(T *ptr, const size_t alignment,
360
+ const char *file, int line,
361
+ const char *ptrname)
362
+ #else
363
+ static HEDLEY_ALWAYS_INLINE void *
364
+ simde_align_assume_to_checked_uncapped(void *ptr, const size_t alignment,
365
+ const char *file, int line,
366
+ const char *ptrname)
367
+ #endif
368
+ {
369
+ if (HEDLEY_UNLIKELY(
370
+ (HEDLEY_REINTERPRET_CAST(SIMDE_ALIGN_INTPTR_T_, (ptr)) %
371
+ HEDLEY_STATIC_CAST(SIMDE_ALIGN_INTPTR_T_,
372
+ SIMDE_ALIGN_CAP(alignment))) != 0)) {
373
+ fprintf(stderr,
374
+ "%s:%d: alignment check failed for `%s' (%p %% %u == %u)\n",
375
+ file, line, ptrname,
376
+ HEDLEY_REINTERPRET_CAST(const void *, ptr),
377
+ HEDLEY_STATIC_CAST(unsigned int,
378
+ SIMDE_ALIGN_CAP(alignment)),
379
+ HEDLEY_STATIC_CAST(
380
+ unsigned int,
381
+ HEDLEY_REINTERPRET_CAST(SIMDE_ALIGN_INTPTR_T_,
382
+ (ptr)) %
383
+ HEDLEY_STATIC_CAST(
384
+ SIMDE_ALIGN_INTPTR_T_,
385
+ SIMDE_ALIGN_CAP(alignment))));
386
+ }
387
+
388
+ return ptr;
389
+ }
390
+
391
+ #if defined(__cplusplus)
392
+ #define SIMDE_ALIGN_ASSUME_TO(Pointer, Alignment) \
393
+ simde_align_assume_to_checked_uncapped((Pointer), (Alignment), \
394
+ __FILE__, __LINE__, #Pointer)
395
+ #else
396
+ #define SIMDE_ALIGN_ASSUME_TO(Pointer, Alignment) \
397
+ simde_align_assume_to_checked_uncapped( \
398
+ HEDLEY_CONST_CAST(void *, HEDLEY_REINTERPRET_CAST( \
399
+ const void *, Pointer)), \
400
+ (Alignment), __FILE__, __LINE__, #Pointer)
401
+ #endif
402
+ #endif
403
+
404
+ /* SIMDE_ALIGN_LIKE(Type)
405
+ * SIMDE_ALIGN_LIKE_#(Type)
406
+ *
407
+ * The SIMDE_ALIGN_LIKE macros are similar to the SIMDE_ALIGN_TO macros
408
+ * except instead of an integer they take a type; basically, it's just
409
+ * a more convenient way to do something like:
410
+ *
411
+ * SIMDE_ALIGN_TO(SIMDE_ALIGN_OF(Type))
412
+ *
413
+ * The versions with a numeric suffix will fall back on using a numeric
414
+ * value in the event we can't use SIMDE_ALIGN_OF(Type). This is
415
+ * mainly for MSVC, where __declspec(align()) can't handle anything
416
+ * other than hard-coded numeric values.
417
+ */
418
+ #if defined(SIMDE_ALIGN_OF) && defined(SIMDE_ALIGN_TO) && \
419
+ !defined(SIMDE_ALIGN_OF_UNUSABLE_FOR_LIKE)
420
+ #define SIMDE_ALIGN_LIKE(Type) SIMDE_ALIGN_TO(SIMDE_ALIGN_OF(Type))
421
+ #define SIMDE_ALIGN_LIKE_64(Type) SIMDE_ALIGN_LIKE(Type)
422
+ #define SIMDE_ALIGN_LIKE_32(Type) SIMDE_ALIGN_LIKE(Type)
423
+ #define SIMDE_ALIGN_LIKE_16(Type) SIMDE_ALIGN_LIKE(Type)
424
+ #define SIMDE_ALIGN_LIKE_8(Type) SIMDE_ALIGN_LIKE(Type)
425
+ #else
426
+ #define SIMDE_ALIGN_LIKE_64(Type) SIMDE_ALIGN_TO_64
427
+ #define SIMDE_ALIGN_LIKE_32(Type) SIMDE_ALIGN_TO_32
428
+ #define SIMDE_ALIGN_LIKE_16(Type) SIMDE_ALIGN_TO_16
429
+ #define SIMDE_ALIGN_LIKE_8(Type) SIMDE_ALIGN_TO_8
430
+ #endif
431
+
432
+ /* SIMDE_ALIGN_ASSUME_LIKE(Pointer, Type)
433
+ *
434
+ * Tihs is similar to SIMDE_ALIGN_ASSUME_TO, except that it takes a
435
+ * type instead of a numeric value. */
436
+ #if defined(SIMDE_ALIGN_OF) && defined(SIMDE_ALIGN_ASSUME_TO)
437
+ #define SIMDE_ALIGN_ASSUME_LIKE(Pointer, Type) \
438
+ SIMDE_ALIGN_ASSUME_TO(Pointer, SIMDE_ALIGN_OF(Type))
439
+ #endif
440
+
441
+ /* SIMDE_ALIGN_CAST(Type, Pointer)
442
+ *
443
+ * SIMDE_ALIGN_CAST is like C++'s reinterpret_cast, but it will try
444
+ * to silence warnings that some compilers may produce if you try
445
+ * to assign to a type with increased alignment requirements.
446
+ *
447
+ * Note that it does *not* actually attempt to tell the compiler that
448
+ * the pointer is aligned like the destination should be; that's the
449
+ * job of the next macro. This macro is necessary for stupid APIs
450
+ * like _mm_loadu_si128 where the input is a __m128i* but the function
451
+ * is specifically for data which isn't necessarily aligned to
452
+ * _Alignof(__m128i).
453
+ */
454
+ #if HEDLEY_HAS_WARNING("-Wcast-align") || defined(__clang__) || \
455
+ HEDLEY_GCC_VERSION_CHECK(3, 4, 0)
456
+ #define SIMDE_ALIGN_CAST(Type, Pointer) \
457
+ (__extension__({ \
458
+ HEDLEY_DIAGNOSTIC_PUSH \
459
+ _Pragma("GCC diagnostic ignored \"-Wcast-align\"") \
460
+ Type simde_r_ = \
461
+ HEDLEY_REINTERPRET_CAST(Type, Pointer); \
462
+ HEDLEY_DIAGNOSTIC_POP \
463
+ simde_r_; \
464
+ }))
465
+ #else
466
+ #define SIMDE_ALIGN_CAST(Type, Pointer) HEDLEY_REINTERPRET_CAST(Type, Pointer)
467
+ #endif
468
+
469
+ /* SIMDE_ALIGN_ASSUME_CAST(Type, Pointer)
470
+ *
471
+ * This is sort of like a combination of a reinterpret_cast and a
472
+ * SIMDE_ALIGN_ASSUME_LIKE. It uses SIMDE_ALIGN_ASSUME_LIKE to tell
473
+ * the compiler that the pointer is aligned like the specified type
474
+ * and casts the pointer to the specified type while suppressing any
475
+ * warnings from the compiler about casting to a type with greater
476
+ * alignment requirements.
477
+ */
478
+ #define SIMDE_ALIGN_ASSUME_CAST(Type, Pointer) \
479
+ SIMDE_ALIGN_ASSUME_LIKE(SIMDE_ALIGN_CAST(Type, Pointer), Type)
480
+
481
+ #endif /* !defined(SIMDE_ALIGN_H) */