@img/sharp-libvips-dev-wasm32 1.2.4 → 1.3.0-rc.10

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 (217) hide show
  1. package/README.md +23 -22
  2. package/include/aom/aom_codec.h +1 -1
  3. package/include/aom/aom_decoder.h +4 -0
  4. package/include/aom/aom_encoder.h +19 -8
  5. package/include/aom/aom_ext_ratectrl.h +664 -0
  6. package/include/aom/aom_image.h +93 -30
  7. package/include/aom/aom_tpl.h +99 -0
  8. package/include/aom/aomcx.h +89 -16
  9. package/include/aom/aomdx.h +12 -0
  10. package/include/expat.h +15 -3
  11. package/include/expat_config.h +6 -6
  12. package/include/expat_external.h +4 -4
  13. package/include/glib-2.0/gio/gdbusconnection.h +2 -8
  14. package/include/glib-2.0/gio/gdbusinterfaceskeleton.h +8 -1
  15. package/include/glib-2.0/gio/gfileattribute.h +1 -1
  16. package/include/glib-2.0/gio/gfileinfo.h +12 -0
  17. package/include/glib-2.0/gio/gicon.h +1 -1
  18. package/include/glib-2.0/gio/gio-autocleanups.h +0 -1
  19. package/include/glib-2.0/gio/gio-visibility.h +68 -0
  20. package/include/glib-2.0/gio/gio.h +2 -0
  21. package/include/glib-2.0/gio/gioenums.h +66 -44
  22. package/include/glib-2.0/gio/gioenumtypes.h +2 -0
  23. package/include/glib-2.0/gio/giptosmessage.h +46 -0
  24. package/include/glib-2.0/gio/gipv6tclassmessage.h +46 -0
  25. package/include/glib-2.0/gio/gresolver.h +1 -1
  26. package/include/glib-2.0/gio/gsettings.h +1 -1
  27. package/include/glib-2.0/gio/gsocketcontrolmessage.h +2 -0
  28. package/include/glib-2.0/glib/gatomic.h +26 -2
  29. package/include/glib-2.0/glib/gfileutils.h +2 -2
  30. package/include/glib-2.0/glib/ghook.h +3 -1
  31. package/include/glib-2.0/glib/giochannel.h +1 -1
  32. package/include/glib-2.0/glib/gkeyfile.h +1 -1
  33. package/include/glib-2.0/glib/glib-visibility.h +68 -0
  34. package/include/glib-2.0/glib/gmacros.h +36 -0
  35. package/include/glib-2.0/glib/gmain.h +4 -0
  36. package/include/glib-2.0/glib/gmarkup.h +20 -1
  37. package/include/glib-2.0/glib/gmem.h +4 -4
  38. package/include/glib-2.0/glib/gmessages.h +7 -9
  39. package/include/glib-2.0/glib/gnode.h +1 -1
  40. package/include/glib-2.0/glib/goption.h +1 -1
  41. package/include/glib-2.0/glib/gsequence.h +2 -2
  42. package/include/glib-2.0/glib/gslice.h +12 -4
  43. package/include/glib-2.0/glib/gspawn.h +1 -1
  44. package/include/glib-2.0/glib/gstrfuncs.h +191 -1
  45. package/include/glib-2.0/glib/gtestutils.h +6 -3
  46. package/include/glib-2.0/glib/gtimer.h +1 -0
  47. package/include/glib-2.0/glib/gtypes.h +46 -4
  48. package/include/glib-2.0/glib/gunicode.h +13 -1
  49. package/include/glib-2.0/glib/guri.h +3 -3
  50. package/include/glib-2.0/glib/gutils.h +10 -1
  51. package/include/glib-2.0/glib/gvarianttype.h +16 -16
  52. package/include/glib-2.0/glib/gversionmacros.h +31 -0
  53. package/include/glib-2.0/glib-unix.h +4 -0
  54. package/include/glib-2.0/gmodule/gmodule-visibility.h +68 -0
  55. package/include/glib-2.0/gmodule.h +1 -1
  56. package/include/glib-2.0/gobject/gbinding.h +1 -1
  57. package/include/glib-2.0/gobject/genums.h +2 -2
  58. package/include/glib-2.0/gobject/gobject-visibility.h +68 -0
  59. package/include/glib-2.0/gobject/gobject.h +1 -1
  60. package/include/glib-2.0/gobject/gparam.h +1 -1
  61. package/include/glib-2.0/gobject/gsignal.h +8 -8
  62. package/include/glib-2.0/gobject/gtype.h +17 -17
  63. package/include/hwy/aligned_allocator.h +44 -2
  64. package/include/hwy/auto_tune.h +22 -6
  65. package/include/hwy/base.h +60 -90
  66. package/include/hwy/bit_set.h +410 -0
  67. package/include/hwy/cache_control.h +3 -2
  68. package/include/hwy/detect_compiler_arch.h +134 -14
  69. package/include/hwy/detect_targets.h +82 -36
  70. package/include/hwy/highway.h +15 -0
  71. package/include/hwy/nanobenchmark.h +12 -3
  72. package/include/hwy/ops/arm_neon-inl.h +96 -25
  73. package/include/hwy/ops/arm_sve-inl.h +250 -95
  74. package/include/hwy/ops/emu128-inl.h +12 -7
  75. package/include/hwy/ops/generic_ops-inl.h +271 -131
  76. package/include/hwy/ops/loongarch_lasx-inl.h +31 -9
  77. package/include/hwy/ops/loongarch_lsx-inl.h +33 -12
  78. package/include/hwy/ops/ppc_vsx-inl.h +99 -19
  79. package/include/hwy/ops/rvv-inl.h +239 -130
  80. package/include/hwy/ops/scalar-inl.h +22 -7
  81. package/include/hwy/ops/set_macros-inl.h +163 -107
  82. package/include/hwy/ops/wasm_128-inl.h +13 -22
  83. package/include/hwy/ops/x86_128-inl.h +223 -120
  84. package/include/hwy/ops/x86_256-inl.h +70 -134
  85. package/include/hwy/ops/x86_512-inl.h +130 -134
  86. package/include/hwy/print-inl.h +2 -0
  87. package/include/hwy/profiler.h +355 -264
  88. package/include/hwy/robust_statistics.h +3 -1
  89. package/include/hwy/timer.h +44 -0
  90. package/include/lcms2.h +35 -5
  91. package/include/lcms2_plugin.h +1 -1
  92. package/include/libexif/exif-utils.h +1 -1
  93. package/include/libheif/heif.h +2 -0
  94. package/include/libheif/heif_aux_images.h +2 -2
  95. package/include/libheif/heif_brands.h +16 -4
  96. package/include/libheif/heif_color.h +147 -25
  97. package/include/libheif/heif_components.h +264 -0
  98. package/include/libheif/heif_context.h +18 -4
  99. package/include/libheif/heif_cxx.h +20 -18
  100. package/include/libheif/heif_decoding.h +63 -9
  101. package/include/libheif/heif_encoding.h +46 -12
  102. package/include/libheif/heif_error.h +15 -6
  103. package/include/libheif/heif_export.h +48 -0
  104. package/include/libheif/heif_image.h +94 -32
  105. package/include/libheif/heif_image_handle.h +54 -3
  106. package/include/libheif/heif_items.h +25 -2
  107. package/include/libheif/heif_library.h +13 -18
  108. package/include/libheif/heif_metadata.h +5 -2
  109. package/include/libheif/heif_omaf.h +104 -0
  110. package/include/libheif/heif_plugin.h +80 -13
  111. package/include/libheif/heif_properties.h +259 -5
  112. package/include/libheif/heif_regions.h +5 -3
  113. package/include/libheif/heif_security.h +24 -2
  114. package/include/libheif/heif_sequences.h +163 -14
  115. package/include/libheif/heif_text.h +161 -0
  116. package/include/libheif/heif_tiling.h +2 -2
  117. package/include/libheif/heif_uncompressed.h +29 -5
  118. package/include/libheif/heif_version.h +2 -2
  119. package/include/libpng16/png.h +3526 -0
  120. package/include/libpng16/pngconf.h +615 -0
  121. package/include/libpng16/pnglibconf.h +233 -0
  122. package/include/png.h +3526 -0
  123. package/include/pngconf.h +615 -0
  124. package/include/pnglibconf.h +233 -0
  125. package/include/resvg.h +3 -3
  126. package/include/tiffconf.h +9 -10
  127. package/include/tiffio.h +10 -9
  128. package/include/tiffvers.h +1 -1
  129. package/include/ultrahdr_api.h +892 -0
  130. package/include/vips/VError8.h +17 -14
  131. package/include/vips/VImage8.h +235 -32
  132. package/include/vips/arithmetic.h +9 -9
  133. package/include/vips/basic.h +11 -1
  134. package/include/vips/colour.h +19 -2
  135. package/include/vips/conversion.h +8 -8
  136. package/include/vips/convolution.h +1 -1
  137. package/include/vips/create.h +2 -2
  138. package/include/vips/draw.h +1 -1
  139. package/include/vips/enumtypes.h +3 -0
  140. package/include/vips/foreign.h +74 -15
  141. package/include/vips/header.h +22 -0
  142. package/include/vips/image.h +8 -5
  143. package/include/vips/memory.h +1 -1
  144. package/include/vips/morphology.h +1 -1
  145. package/include/vips/operation.h +2 -1
  146. package/include/vips/private.h +5 -10
  147. package/include/vips/region.h +7 -1
  148. package/include/vips/resample.h +2 -2
  149. package/include/vips/semaphore.h +1 -5
  150. package/include/vips/threadpool.h +0 -1
  151. package/include/vips/version.h +6 -6
  152. package/include/zlib.h +5 -5
  153. package/lib/glib-2.0/include/glibconfig.h +2 -4
  154. package/lib/libaom.a +0 -0
  155. package/lib/libcgif.a +0 -0
  156. package/lib/libexif.a +0 -0
  157. package/lib/libexif.la +1 -1
  158. package/lib/libexpat.a +0 -0
  159. package/lib/libexpat.la +2 -2
  160. package/lib/libffi.a +0 -0
  161. package/lib/libgio-2.0.a +0 -0
  162. package/lib/libglib-2.0.a +0 -0
  163. package/lib/libgmodule-2.0.a +0 -0
  164. package/lib/libgobject-2.0.a +0 -0
  165. package/lib/libgthread-2.0.a +0 -0
  166. package/lib/libheif.a +0 -0
  167. package/lib/libhwy.a +0 -0
  168. package/lib/libimagequant.a +0 -0
  169. package/lib/libjpeg.a +0 -0
  170. package/lib/liblcms2.a +0 -0
  171. package/lib/libpng.a +0 -0
  172. package/lib/{libsharpyuv.la → libpng.la} +8 -8
  173. package/lib/libpng16.a +0 -0
  174. package/lib/{libwebp.la → libpng16.la} +7 -7
  175. package/lib/libresvg.a +0 -0
  176. package/lib/libsharpyuv.a +0 -0
  177. package/lib/libtiff.a +0 -0
  178. package/lib/libuhdr.a +0 -0
  179. package/lib/libvips-cpp.a +0 -0
  180. package/lib/libvips.a +0 -0
  181. package/lib/libwebp.a +0 -0
  182. package/lib/libwebpdecoder.a +0 -0
  183. package/lib/libwebpdemux.a +0 -0
  184. package/lib/libwebpmux.a +0 -0
  185. package/lib/libz.a +0 -0
  186. package/lib/pkgconfig/aom.pc +2 -2
  187. package/lib/pkgconfig/cgif.pc +1 -1
  188. package/lib/pkgconfig/expat.pc +1 -1
  189. package/lib/pkgconfig/gio-2.0.pc +1 -1
  190. package/lib/pkgconfig/glib-2.0.pc +1 -1
  191. package/lib/pkgconfig/gmodule-2.0.pc +1 -1
  192. package/lib/pkgconfig/gmodule-export-2.0.pc +1 -1
  193. package/lib/pkgconfig/gmodule-no-export-2.0.pc +1 -1
  194. package/lib/pkgconfig/gobject-2.0.pc +1 -1
  195. package/lib/pkgconfig/gthread-2.0.pc +1 -1
  196. package/lib/pkgconfig/lcms2.pc +1 -1
  197. package/lib/pkgconfig/libexif.pc +1 -1
  198. package/lib/pkgconfig/libheif.pc +1 -1
  199. package/lib/pkgconfig/libhwy.pc +3 -4
  200. package/lib/pkgconfig/libpng.pc +12 -0
  201. package/lib/pkgconfig/libpng16.pc +12 -0
  202. package/lib/pkgconfig/libsharpyuv.pc +1 -1
  203. package/lib/pkgconfig/libtiff-4.pc +2 -2
  204. package/lib/pkgconfig/libuhdr.pc +11 -0
  205. package/lib/pkgconfig/libwebp.pc +1 -1
  206. package/lib/pkgconfig/libwebpdecoder.pc +11 -0
  207. package/lib/pkgconfig/libwebpmux.pc +1 -1
  208. package/lib/pkgconfig/vips-cpp.pc +2 -2
  209. package/lib/pkgconfig/vips.pc +2 -2
  210. package/package.json +1 -1
  211. package/versions.json +15 -14
  212. package/include/spng.h +0 -537
  213. package/lib/libspng.a +0 -0
  214. package/lib/libtiff.la +0 -41
  215. package/lib/libwebpdemux.la +0 -41
  216. package/lib/libwebpmux.la +0 -41
  217. package/lib/pkgconfig/spng.pc +0 -10
@@ -1086,3 +1086,71 @@
1086
1086
  #define GOBJECT_AVAILABLE_ENUMERATOR_IN_2_86
1087
1087
  #define GOBJECT_AVAILABLE_TYPE_IN_2_86
1088
1088
  #endif
1089
+
1090
+ #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_88
1091
+ #define GOBJECT_DEPRECATED_IN_2_88 GOBJECT_DEPRECATED
1092
+ #define GOBJECT_DEPRECATED_IN_2_88_FOR(f) GOBJECT_DEPRECATED_FOR (f)
1093
+ #define GOBJECT_DEPRECATED_MACRO_IN_2_88 GLIB_DEPRECATED_MACRO
1094
+ #define GOBJECT_DEPRECATED_MACRO_IN_2_88_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
1095
+ #define GOBJECT_DEPRECATED_ENUMERATOR_IN_2_88 GLIB_DEPRECATED_ENUMERATOR
1096
+ #define GOBJECT_DEPRECATED_ENUMERATOR_IN_2_88_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
1097
+ #define GOBJECT_DEPRECATED_TYPE_IN_2_88 GLIB_DEPRECATED_TYPE
1098
+ #define GOBJECT_DEPRECATED_TYPE_IN_2_88_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
1099
+ #else
1100
+ #define GOBJECT_DEPRECATED_IN_2_88 _GOBJECT_EXTERN
1101
+ #define GOBJECT_DEPRECATED_IN_2_88_FOR(f) _GOBJECT_EXTERN
1102
+ #define GOBJECT_DEPRECATED_MACRO_IN_2_88
1103
+ #define GOBJECT_DEPRECATED_MACRO_IN_2_88_FOR(f)
1104
+ #define GOBJECT_DEPRECATED_ENUMERATOR_IN_2_88
1105
+ #define GOBJECT_DEPRECATED_ENUMERATOR_IN_2_88_FOR(f)
1106
+ #define GOBJECT_DEPRECATED_TYPE_IN_2_88
1107
+ #define GOBJECT_DEPRECATED_TYPE_IN_2_88_FOR(f)
1108
+ #endif
1109
+
1110
+ #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_88
1111
+ #define GOBJECT_AVAILABLE_IN_2_88 GOBJECT_UNAVAILABLE (2, 88)
1112
+ #define GOBJECT_AVAILABLE_STATIC_INLINE_IN_2_88 GLIB_UNAVAILABLE_STATIC_INLINE (2, 88)
1113
+ #define GOBJECT_AVAILABLE_MACRO_IN_2_88 GLIB_UNAVAILABLE_MACRO (2, 88)
1114
+ #define GOBJECT_AVAILABLE_ENUMERATOR_IN_2_88 GLIB_UNAVAILABLE_ENUMERATOR (2, 88)
1115
+ #define GOBJECT_AVAILABLE_TYPE_IN_2_88 GLIB_UNAVAILABLE_TYPE (2, 88)
1116
+ #else
1117
+ #define GOBJECT_AVAILABLE_IN_2_88 _GOBJECT_EXTERN
1118
+ #define GOBJECT_AVAILABLE_STATIC_INLINE_IN_2_88
1119
+ #define GOBJECT_AVAILABLE_MACRO_IN_2_88
1120
+ #define GOBJECT_AVAILABLE_ENUMERATOR_IN_2_88
1121
+ #define GOBJECT_AVAILABLE_TYPE_IN_2_88
1122
+ #endif
1123
+
1124
+ #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_90
1125
+ #define GOBJECT_DEPRECATED_IN_2_90 GOBJECT_DEPRECATED
1126
+ #define GOBJECT_DEPRECATED_IN_2_90_FOR(f) GOBJECT_DEPRECATED_FOR (f)
1127
+ #define GOBJECT_DEPRECATED_MACRO_IN_2_90 GLIB_DEPRECATED_MACRO
1128
+ #define GOBJECT_DEPRECATED_MACRO_IN_2_90_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
1129
+ #define GOBJECT_DEPRECATED_ENUMERATOR_IN_2_90 GLIB_DEPRECATED_ENUMERATOR
1130
+ #define GOBJECT_DEPRECATED_ENUMERATOR_IN_2_90_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
1131
+ #define GOBJECT_DEPRECATED_TYPE_IN_2_90 GLIB_DEPRECATED_TYPE
1132
+ #define GOBJECT_DEPRECATED_TYPE_IN_2_90_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
1133
+ #else
1134
+ #define GOBJECT_DEPRECATED_IN_2_90 _GOBJECT_EXTERN
1135
+ #define GOBJECT_DEPRECATED_IN_2_90_FOR(f) _GOBJECT_EXTERN
1136
+ #define GOBJECT_DEPRECATED_MACRO_IN_2_90
1137
+ #define GOBJECT_DEPRECATED_MACRO_IN_2_90_FOR(f)
1138
+ #define GOBJECT_DEPRECATED_ENUMERATOR_IN_2_90
1139
+ #define GOBJECT_DEPRECATED_ENUMERATOR_IN_2_90_FOR(f)
1140
+ #define GOBJECT_DEPRECATED_TYPE_IN_2_90
1141
+ #define GOBJECT_DEPRECATED_TYPE_IN_2_90_FOR(f)
1142
+ #endif
1143
+
1144
+ #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_90
1145
+ #define GOBJECT_AVAILABLE_IN_2_90 GOBJECT_UNAVAILABLE (2, 90)
1146
+ #define GOBJECT_AVAILABLE_STATIC_INLINE_IN_2_90 GLIB_UNAVAILABLE_STATIC_INLINE (2, 90)
1147
+ #define GOBJECT_AVAILABLE_MACRO_IN_2_90 GLIB_UNAVAILABLE_MACRO (2, 90)
1148
+ #define GOBJECT_AVAILABLE_ENUMERATOR_IN_2_90 GLIB_UNAVAILABLE_ENUMERATOR (2, 90)
1149
+ #define GOBJECT_AVAILABLE_TYPE_IN_2_90 GLIB_UNAVAILABLE_TYPE (2, 90)
1150
+ #else
1151
+ #define GOBJECT_AVAILABLE_IN_2_90 _GOBJECT_EXTERN
1152
+ #define GOBJECT_AVAILABLE_STATIC_INLINE_IN_2_90
1153
+ #define GOBJECT_AVAILABLE_MACRO_IN_2_90
1154
+ #define GOBJECT_AVAILABLE_ENUMERATOR_IN_2_90
1155
+ #define GOBJECT_AVAILABLE_TYPE_IN_2_90
1156
+ #endif
@@ -356,7 +356,7 @@ struct _GObjectClass
356
356
  /*< private >*/
357
357
  gsize flags;
358
358
 
359
- gsize n_construct_properties;
359
+ gsize n_construct_properties; /* functionally this is limited to UINT_MAX */
360
360
 
361
361
  gpointer pspecs;
362
362
  gsize n_pspecs;
@@ -169,7 +169,7 @@ typedef enum
169
169
  G_PARAM_EXPLICIT_NOTIFY = 1 << 30,
170
170
  /* Avoid warning with -Wpedantic for gcc6 */
171
171
  G_PARAM_DEPRECATED = (gint)(1u << 31)
172
- } GParamFlags;
172
+ } G_GNUC_FLAG_ENUM GParamFlags;
173
173
 
174
174
  /**
175
175
  * G_PARAM_STATIC_STRINGS:
@@ -109,16 +109,16 @@ typedef gboolean (*GSignalAccumulator) (GSignalInvocationHint *ihint,
109
109
  /* --- run, match and connect types --- */
110
110
  /**
111
111
  * GSignalFlags:
112
- * @G_SIGNAL_RUN_FIRST: Invoke the object method handler in the first emission stage.
113
- * @G_SIGNAL_RUN_LAST: Invoke the object method handler in the third emission stage.
114
- * @G_SIGNAL_RUN_CLEANUP: Invoke the object method handler in the last emission stage.
112
+ * @G_SIGNAL_RUN_FIRST: Invoke the default signal handler in the first emission stage
113
+ * @G_SIGNAL_RUN_LAST: Invoke the default signal handler in the third emission stage
114
+ * @G_SIGNAL_RUN_CLEANUP: Invoke the default signal handler in the last emission stage
115
115
  * @G_SIGNAL_NO_RECURSE: Signals being emitted for an object while currently being in
116
116
  * emission for this very object will not be emitted recursively,
117
117
  * but instead cause the first emission to be restarted.
118
- * @G_SIGNAL_DETAILED: This signal supports "::detail" appendices to the signal name
118
+ * @G_SIGNAL_DETAILED: This signal supports `::detail` appendices to the signal name
119
119
  * upon handler connections and emissions.
120
120
  * @G_SIGNAL_ACTION: Action signals are signals that may freely be emitted on alive
121
- * objects from user code via g_signal_emit() and friends, without
121
+ * objects from user code via [func@GObject.signal_emit] and friends, without
122
122
  * the need of being embedded into extra code that performs pre or
123
123
  * post emission adjustments on the object. They can also be thought
124
124
  * of as object methods which can be called generically by
@@ -140,7 +140,7 @@ typedef enum
140
140
  G_SIGNAL_DEPRECATED = 1 << 8,
141
141
  /* normal signal flags until 1 << 16 */
142
142
  G_SIGNAL_ACCUMULATOR_FIRST_RUN = 1 << 17,
143
- } GSignalFlags;
143
+ } G_GNUC_FLAG_ENUM GSignalFlags;
144
144
 
145
145
  /**
146
146
  * G_SIGNAL_MUST_COLLECT:
@@ -197,7 +197,7 @@ typedef enum
197
197
  G_CONNECT_DEFAULT GOBJECT_AVAILABLE_ENUMERATOR_IN_2_74 = 0,
198
198
  G_CONNECT_AFTER = 1 << 0,
199
199
  G_CONNECT_SWAPPED = 1 << 1
200
- } GConnectFlags;
200
+ } G_GNUC_FLAG_ENUM GConnectFlags;
201
201
  /**
202
202
  * GSignalMatchType:
203
203
  * @G_SIGNAL_MATCH_ID: The signal id must be equal.
@@ -219,7 +219,7 @@ typedef enum
219
219
  G_SIGNAL_MATCH_FUNC = 1 << 3,
220
220
  G_SIGNAL_MATCH_DATA = 1 << 4,
221
221
  G_SIGNAL_MATCH_UNBLOCKED = 1 << 5
222
- } GSignalMatchType;
222
+ } G_GNUC_FLAG_ENUM GSignalMatchType;
223
223
  /**
224
224
  * G_SIGNAL_MATCH_MASK:
225
225
  *
@@ -728,7 +728,7 @@ typedef enum /*< skip >*/
728
728
  G_TYPE_DEBUG_SIGNALS = 1 << 1,
729
729
  G_TYPE_DEBUG_INSTANCE_COUNT = 1 << 2,
730
730
  G_TYPE_DEBUG_MASK = 0x07
731
- } GTypeDebugFlags GOBJECT_DEPRECATED_TYPE_IN_2_36;
731
+ } G_GNUC_FLAG_ENUM GTypeDebugFlags GOBJECT_DEPRECATED_TYPE_IN_2_36;
732
732
 
733
733
 
734
734
  /* --- prototypes --- */
@@ -1067,7 +1067,7 @@ typedef enum /*< skip >*/
1067
1067
  G_TYPE_FLAG_INSTANTIATABLE = (1 << 1),
1068
1068
  G_TYPE_FLAG_DERIVABLE = (1 << 2),
1069
1069
  G_TYPE_FLAG_DEEP_DERIVABLE = (1 << 3)
1070
- } GTypeFundamentalFlags;
1070
+ } G_GNUC_FLAG_ENUM GTypeFundamentalFlags;
1071
1071
  /**
1072
1072
  * GTypeFlags:
1073
1073
  * @G_TYPE_FLAG_NONE: No special flags. Since: 2.74
@@ -1091,7 +1091,7 @@ typedef enum /*< skip >*/
1091
1091
  G_TYPE_FLAG_VALUE_ABSTRACT = (1 << 5),
1092
1092
  G_TYPE_FLAG_FINAL GOBJECT_AVAILABLE_ENUMERATOR_IN_2_70 = (1 << 6),
1093
1093
  G_TYPE_FLAG_DEPRECATED GOBJECT_AVAILABLE_ENUMERATOR_IN_2_76 = (1 << 7)
1094
- } GTypeFlags;
1094
+ } G_GNUC_FLAG_ENUM GTypeFlags;
1095
1095
  /**
1096
1096
  * GTypeInfo:
1097
1097
  * @class_size: Size of the class structure (required for interface, classed and instantiatable types)
@@ -1574,7 +1574,7 @@ guint g_type_get_type_registration_serial (void);
1574
1574
  * - the usual `my_app_window_get_type()` function is declared with a return type of #GType
1575
1575
  *
1576
1576
  * - the `MyAppWindow` type is defined as a `typedef` of `struct _MyAppWindow`. The struct itself is not
1577
- * defined and should be defined from the .c file before G_DEFINE_TYPE() is used.
1577
+ * defined and should be defined from the `.c` file before `G_DEFINE_TYPE()` is used.
1578
1578
  *
1579
1579
  * - the `MY_APP_WINDOW()` cast is emitted as `static inline` function along with the `MY_APP_IS_WINDOW()` type
1580
1580
  * checking function
@@ -1585,9 +1585,9 @@ guint g_type_get_type_registration_serial (void);
1585
1585
  * and therefore the fact that the size of the class structure is exposed is not a concern and it can be
1586
1586
  * freely changed at any point in the future.
1587
1587
  *
1588
- * - g_autoptr() support being added for your type, based on the type of your parent class
1588
+ * - `g_autoptr()` support being added for your type, based on the type of your parent class
1589
1589
  *
1590
- * You can only use this function if your parent type also supports g_autoptr().
1590
+ * You can only use this function if your parent type also supports `g_autoptr()`.
1591
1591
  *
1592
1592
  * Because the type macro (`MY_APP_TYPE_WINDOW` in the above example) is not a callable, you must continue to
1593
1593
  * manually define this as a macro for yourself.
@@ -1595,11 +1595,11 @@ guint g_type_get_type_registration_serial (void);
1595
1595
  * The declaration of the `_get_type()` function is the first thing emitted by the macro. This allows this macro
1596
1596
  * to be used in the usual way with export control and API versioning macros.
1597
1597
  *
1598
- * If you want to declare your own class structure, use G_DECLARE_DERIVABLE_TYPE().
1598
+ * If you want to declare your own class structure, use [func@GObject.DECLARE_DERIVABLE_TYPE].
1599
1599
  *
1600
1600
  * If you are writing a library, it is important to note that it is possible to convert a type from using
1601
- * G_DECLARE_FINAL_TYPE() to G_DECLARE_DERIVABLE_TYPE() without breaking API or ABI. As a precaution, you
1602
- * should therefore use G_DECLARE_FINAL_TYPE() until you are sure that it makes sense for your class to be
1601
+ * `G_DECLARE_FINAL_TYPE()` to `G_DECLARE_DERIVABLE_TYPE()` without breaking API or ABI. As a precaution, you
1602
+ * should therefore use `G_DECLARE_FINAL_TYPE()` until you are sure that it makes sense for your class to be
1603
1603
  * subclassed. Once a class structure has been exposed it is not possible to change its size or remove or
1604
1604
  * reorder items without breaking the API and/or ABI.
1605
1605
  *
@@ -1687,7 +1687,7 @@ guint g_type_get_type_registration_serial (void);
1687
1687
  *
1688
1688
  * - g_autoptr() support being added for your type, based on the type of your parent class
1689
1689
  *
1690
- * You can only use this function if your parent type also supports g_autoptr().
1690
+ * You can only use this function if your parent type also supports `g_autoptr()`.
1691
1691
  *
1692
1692
  * Because the type macro (`GTK_TYPE_FROBBER` in the above example) is not a callable, you must continue to
1693
1693
  * manually define this as a macro for yourself.
@@ -1696,14 +1696,14 @@ guint g_type_get_type_registration_serial (void);
1696
1696
  * to be used in the usual way with export control and API versioning macros.
1697
1697
  *
1698
1698
  * If you are writing a library, it is important to note that it is possible to convert a type from using
1699
- * G_DECLARE_FINAL_TYPE() to G_DECLARE_DERIVABLE_TYPE() without breaking API or ABI. As a precaution, you
1700
- * should therefore use G_DECLARE_FINAL_TYPE() until you are sure that it makes sense for your class to be
1699
+ * [func@GObject.DECLARE_FINAL_TYPE] to `G_DECLARE_DERIVABLE_TYPE()` without breaking API or ABI. As a precaution, you
1700
+ * should therefore use `G_DECLARE_FINAL_TYPE()` until you are sure that it makes sense for your class to be
1701
1701
  * subclassed. Once a class structure has been exposed it is not possible to change its size or remove or
1702
1702
  * reorder items without breaking the API and/or ABI. If you want to declare your own class structure, use
1703
- * G_DECLARE_DERIVABLE_TYPE(). If you want to declare a class without exposing the class or instance
1704
- * structures, use G_DECLARE_FINAL_TYPE().
1703
+ * `G_DECLARE_DERIVABLE_TYPE()`. If you want to declare a class without exposing the class or instance
1704
+ * structures, use `G_DECLARE_FINAL_TYPE()`.
1705
1705
  *
1706
- * If you must use G_DECLARE_DERIVABLE_TYPE() you should be sure to include some padding at the bottom of your
1706
+ * If you must use `G_DECLARE_DERIVABLE_TYPE()` you should be sure to include some padding at the bottom of your
1707
1707
  * class structure to leave space for the addition of future virtual functions.
1708
1708
  *
1709
1709
  * Since: 2.44
@@ -1931,9 +1931,9 @@ guint g_type_get_type_registration_serial (void);
1931
1931
  *
1932
1932
  * A convenience macro for type implementations.
1933
1933
  *
1934
- * Similar to G_DEFINE_TYPE(), but defines a final type.
1934
+ * Similar to [func@GObject.DEFINE_TYPE], but defines a final type.
1935
1935
  *
1936
- * See G_DEFINE_TYPE_EXTENDED() for an example.
1936
+ * See [func@GObject.DEFINE_TYPE_EXTENDED] for an example.
1937
1937
  *
1938
1938
  * Since: 2.70
1939
1939
  */
@@ -119,8 +119,21 @@ template <typename T, typename... Args>
119
119
  AlignedUniquePtr<T> MakeUniqueAlignedWithAlloc(AllocPtr alloc, FreePtr free,
120
120
  void* opaque, Args&&... args) {
121
121
  T* ptr = static_cast<T*>(AllocateAlignedBytes(sizeof(T), alloc, opaque));
122
+ if (HWY_UNLIKELY(ptr == nullptr)) {
123
+ return AlignedUniquePtr<T>(nullptr, AlignedDeleter(free, opaque));
124
+ }
125
+ #ifdef HWY_EXCEPTIONS_ENABLED
126
+ try {
127
+ return AlignedUniquePtr<T>(new (ptr) T(std::forward<Args>(args)...),
128
+ AlignedDeleter(free, opaque));
129
+ } catch (...) {
130
+ FreeAlignedBytes(ptr, free, opaque);
131
+ throw;
132
+ }
133
+ #else
122
134
  return AlignedUniquePtr<T>(new (ptr) T(std::forward<Args>(args)...),
123
135
  AlignedDeleter(free, opaque));
136
+ #endif
124
137
  }
125
138
 
126
139
  // Similar to MakeUniqueAlignedWithAlloc but using the default alloc/free
@@ -128,8 +141,21 @@ AlignedUniquePtr<T> MakeUniqueAlignedWithAlloc(AllocPtr alloc, FreePtr free,
128
141
  template <typename T, typename... Args>
129
142
  AlignedUniquePtr<T> MakeUniqueAligned(Args&&... args) {
130
143
  T* ptr = static_cast<T*>(AllocateAlignedBytes(sizeof(T)));
144
+ if (HWY_UNLIKELY(ptr == nullptr)) {
145
+ return AlignedUniquePtr<T>(nullptr, AlignedDeleter());
146
+ }
147
+ #ifdef HWY_EXCEPTIONS_ENABLED
148
+ try {
149
+ return AlignedUniquePtr<T>(new (ptr) T(std::forward<Args>(args)...),
150
+ AlignedDeleter());
151
+ } catch (...) {
152
+ FreeAlignedBytes(ptr, nullptr, nullptr);
153
+ throw;
154
+ }
155
+ #else
131
156
  return AlignedUniquePtr<T>(new (ptr) T(std::forward<Args>(args)...),
132
157
  AlignedDeleter());
158
+ #endif
133
159
  }
134
160
 
135
161
  template <class T>
@@ -147,8 +173,13 @@ struct AlignedAllocator {
147
173
  "AlignedAllocator only supports integer types");
148
174
  static_assert(sizeof(V) <= sizeof(std::size_t),
149
175
  "V n must be smaller or equal size_t to avoid overflow");
176
+ const size_t count = static_cast<std::size_t>(n);
177
+ if (HWY_LIKELY(count != 0) && sizeof(value_type) > SIZE_MAX / count) {
178
+ HWY_ABORT("AlignedAllocator: allocation size overflow "
179
+ "(%zu * %zu exceeds size_t)", count, sizeof(value_type));
180
+ }
150
181
  return static_cast<value_type*>(
151
- AllocateAlignedBytes(static_cast<std::size_t>(n) * sizeof(value_type)));
182
+ AllocateAlignedBytes(count * sizeof(value_type)));
152
183
  }
153
184
 
154
185
  template <class V>
@@ -208,7 +239,7 @@ AlignedUniquePtr<T[]> MakeUniqueAlignedArrayWithAlloc(
208
239
  T* ptr = detail::AllocateAlignedItems<T>(items, alloc, opaque);
209
240
  if (ptr != nullptr) {
210
241
  for (size_t i = 0; i < items; i++) {
211
- new (ptr + i) T(std::forward<Args>(args)...);
242
+ new (ptr + i) T(args...);
212
243
  }
213
244
  }
214
245
  return AlignedUniquePtr<T[]>(ptr, AlignedDeleter(free, opaque));
@@ -399,6 +430,10 @@ class AlignedNDArray {
399
430
  size_t offset = 0;
400
431
  size_t shape_index = 0;
401
432
  for (const size_t axis_index : indices) {
433
+ if (HWY_UNLIKELY(axis_index >= shape_[shape_index])) {
434
+ HWY_ABORT("AlignedNDArray index %zu out of bounds (axis %zu, size %zu)",
435
+ axis_index, shape_index, shape_[shape_index]);
436
+ }
402
437
  offset += memory_sizes_[shape_index + 1] * axis_index;
403
438
  shape_index++;
404
439
  }
@@ -417,6 +452,13 @@ class AlignedNDArray {
417
452
  sizes[axis] = 1;
418
453
  while (axis > 0) {
419
454
  --axis;
455
+ // Check for integer overflow in dimension multiplication.
456
+ if (HWY_LIKELY(shape[axis] != 0) &&
457
+ sizes[axis + 1] > SIZE_MAX / shape[axis]) {
458
+ HWY_ABORT("AlignedNDArray: dimension overflow at axis %zu "
459
+ "(%zu * %zu exceeds size_t)",
460
+ axis, sizes[axis + 1], shape[axis]);
461
+ }
420
462
  sizes[axis] = sizes[axis + 1] * shape[axis];
421
463
  }
422
464
  return sizes;
@@ -25,7 +25,18 @@
25
25
 
26
26
  #include "hwy/aligned_allocator.h" // Span
27
27
  #include "hwy/base.h" // HWY_MIN
28
- #include "hwy/contrib/sort/vqsort.h"
28
+
29
+ // configuration to allow auto_tune to use std::sort instead of VQSort
30
+ // (also enabled in header only mode).
31
+ #if defined(HWY_HEADER_ONLY)
32
+ #define HWY_AUTOTUNE_STDSORT
33
+ #endif
34
+
35
+ #ifdef HWY_AUTOTUNE_STDSORT
36
+ #include <algorithm> // std::sort
37
+ #else
38
+ #include "hwy/contrib/sort/vqsort.h" // VQSort
39
+ #endif
29
40
 
30
41
  // Infrastructure for auto-tuning (choosing optimal parameters at runtime).
31
42
 
@@ -104,6 +115,10 @@ class CostDistribution {
104
115
  private:
105
116
  static double Median(double* to_sort, size_t n) {
106
117
  HWY_DASSERT(n >= 2);
118
+
119
+ #ifdef HWY_AUTOTUNE_STDSORT
120
+ std::sort(to_sort, to_sort + n);
121
+ #else
107
122
  // F64 is supported everywhere except Armv7.
108
123
  #if !HWY_ARCH_ARM_V7
109
124
  VQSort(to_sort, n, SortAscending());
@@ -112,6 +127,8 @@ class CostDistribution {
112
127
  // equivalent.
113
128
  VQSort(reinterpret_cast<uint64_t*>(to_sort), n, SortAscending());
114
129
  #endif
130
+ #endif
131
+
115
132
  if (n & 1) return to_sort[n / 2];
116
133
  // Even length: average of two middle elements.
117
134
  return (to_sort[n / 2] + to_sort[n / 2 - 1]) * 0.5;
@@ -405,10 +422,9 @@ class AutoTune {
405
422
  const Config* Best() const { return best_; }
406
423
 
407
424
  // If false, caller must call `SetCandidates` before `NextConfig`.
408
- bool HasCandidates() const {
409
- HWY_DASSERT(!Best());
410
- return !candidates_.empty();
411
- }
425
+ // NOTE: also called after Best() is non-null.
426
+ bool HasCandidates() const { return !candidates_.empty(); }
427
+
412
428
  // WARNING: invalidates `Best()`, do not call if that is non-null.
413
429
  void SetCandidates(std::vector<Config> candidates) {
414
430
  HWY_DASSERT(!Best() && !HasCandidates());
@@ -429,7 +445,7 @@ class AutoTune {
429
445
 
430
446
  // Returns the current `Config` to measure.
431
447
  const Config& NextConfig() const {
432
- HWY_DASSERT(!Best() && HasCandidates());
448
+ HWY_DASSERT(HasCandidates());
433
449
  return candidates_[config_idx_];
434
450
  }
435
451
 
@@ -22,8 +22,8 @@
22
22
  #include <stddef.h>
23
23
  #include <stdint.h>
24
24
  #if defined(HWY_HEADER_ONLY)
25
- #include <cstdarg>
26
- #include <cstdio>
25
+ #include <stdarg.h>
26
+ #include <stdio.h>
27
27
  #endif
28
28
 
29
29
  #if !defined(HWY_NO_LIBCXX)
@@ -33,9 +33,10 @@
33
33
  #include "hwy/detect_compiler_arch.h"
34
34
  #include "hwy/highway_export.h"
35
35
 
36
- // API version (https://semver.org/); keep in sync with CMakeLists.txt.
36
+ // API version (https://semver.org/); keep in sync with CMakeLists.txt and
37
+ // meson.build.
37
38
  #define HWY_MAJOR 1
38
- #define HWY_MINOR 3
39
+ #define HWY_MINOR 4
39
40
  #define HWY_PATCH 0
40
41
 
41
42
  // True if the Highway version >= major.minor.0. Added in 1.2.0.
@@ -57,7 +58,7 @@
57
58
 
58
59
  #endif // !HWY_IDE
59
60
 
60
- #if (HWY_ARCH_X86 && !defined(HWY_NO_LIBCXX)) || HWY_COMPILER_MSVC
61
+ #if !defined(HWY_NO_LIBCXX) || HWY_COMPILER_MSVC
61
62
  #include <atomic>
62
63
  #endif
63
64
 
@@ -148,6 +149,21 @@
148
149
 
149
150
  #endif // !HWY_COMPILER_MSVC
150
151
 
152
+ #if (HWY_COMPILER_GCC_ACTUAL && HWY_COMPILER_GCC_ACTUAL < 1200) || \
153
+ (HWY_COMPILER_ICC && !HWY_COMPILER_ICX)
154
+ // The use of __attribute__((unused)) in private class member variables triggers
155
+ // a compiler warning with GCC 11 and earlier and ICC
156
+
157
+ // GCC 11 and earlier and ICC also do not emit -Wunused-private-field warnings
158
+ // for unused private class member variables
159
+ #define HWY_MEMBER_VAR_MAYBE_UNUSED
160
+ #else
161
+ // Clang and ICX need __attribute__((unused)) in unused private class member
162
+ // variables to suppress -Wunused-private-field warnings unless this warning is
163
+ // ignored by using HWY_DIAGNOSTICS_OFF
164
+ #define HWY_MEMBER_VAR_MAYBE_UNUSED HWY_MAYBE_UNUSED
165
+ #endif
166
+
151
167
  //------------------------------------------------------------------------------
152
168
  // Builtin/attributes (no more #include after this point due to namespace!)
153
169
 
@@ -202,7 +218,9 @@ namespace hwy {
202
218
  //------------------------------------------------------------------------------
203
219
  // Macros
204
220
 
205
- #define HWY_API static HWY_INLINE HWY_FLATTEN HWY_MAYBE_UNUSED
221
+ // Note: it is safe to remove `static` for users who want to use modules, but
222
+ // that might be a breaking change for some users, hence we do not by default.
223
+ #define HWY_API static HWY_INLINE HWY_FLATTEN
206
224
 
207
225
  #define HWY_CONCAT_IMPL(a, b) a##b
208
226
  #define HWY_CONCAT(a, b) HWY_CONCAT_IMPL(a, b)
@@ -349,60 +367,20 @@ HWY_DLLEXPORT HWY_NORETURN void HWY_FORMAT(3, 4)
349
367
  } while (0)
350
368
  #define HWY_ASSERT(condition) HWY_ASSERT_M(condition, "")
351
369
 
352
- #if HWY_HAS_FEATURE(memory_sanitizer) || defined(MEMORY_SANITIZER) || \
353
- defined(__SANITIZE_MEMORY__)
354
- #define HWY_IS_MSAN 1
355
- #else
356
- #define HWY_IS_MSAN 0
357
- #endif
358
-
359
- #if HWY_HAS_FEATURE(address_sanitizer) || defined(ADDRESS_SANITIZER) || \
360
- defined(__SANITIZE_ADDRESS__)
361
- #define HWY_IS_ASAN 1
362
- #else
363
- #define HWY_IS_ASAN 0
364
- #endif
365
-
366
- #if HWY_HAS_FEATURE(hwaddress_sanitizer) || defined(HWADDRESS_SANITIZER) || \
367
- defined(__SANITIZE_HWADDRESS__)
368
- #define HWY_IS_HWASAN 1
369
- #else
370
- #define HWY_IS_HWASAN 0
371
- #endif
372
-
373
- #if HWY_HAS_FEATURE(thread_sanitizer) || defined(THREAD_SANITIZER) || \
374
- defined(__SANITIZE_THREAD__)
375
- #define HWY_IS_TSAN 1
376
- #else
377
- #define HWY_IS_TSAN 0
378
- #endif
379
-
380
- #if HWY_HAS_FEATURE(undefined_behavior_sanitizer) || \
381
- defined(UNDEFINED_BEHAVIOR_SANITIZER)
382
- #define HWY_IS_UBSAN 1
383
- #else
384
- #define HWY_IS_UBSAN 0
385
- #endif
386
-
387
- // MSAN may cause lengthy build times or false positives e.g. in AVX3 DemoteTo.
388
- // You can disable MSAN by adding this attribute to the function that fails.
389
- #if HWY_IS_MSAN
390
- #define HWY_ATTR_NO_MSAN __attribute__((no_sanitize_memory))
391
- #else
392
- #define HWY_ATTR_NO_MSAN
393
- #endif
394
-
395
- #if HWY_IS_ASAN || HWY_IS_HWASAN || HWY_IS_MSAN || HWY_IS_TSAN || HWY_IS_UBSAN
396
- #define HWY_IS_SANITIZER 1
397
- #else
398
- #define HWY_IS_SANITIZER 0
399
- #endif
400
-
401
370
  // For enabling HWY_DASSERT and shortening tests in slower debug builds
371
+ //
372
+ // Note: `HWY_IS_UBSAN` is specifically excluded from engaging debug
373
+ // builds. This is in service of Chromium's `-fsanitize=array-bounds` by
374
+ // default, where we don't want Highway to unconditionally build in
375
+ // debug mode.
376
+ //
377
+ // See also:
378
+ // https://docs.google.com/document/d/1eCtY4AZF-SiFHxhIYWzEytdIx3C24de7ccD6Y5Gn2H8/edit?tab=t.9zkn85hr82ms#heading=h.efcshvfql42c
402
379
  #if !defined(HWY_IS_DEBUG_BUILD)
403
380
  // Clang does not define NDEBUG, but it and GCC define __OPTIMIZE__, and recent
404
381
  // MSVC defines NDEBUG (if not, could instead check _DEBUG).
405
- #if (!defined(__OPTIMIZE__) && !defined(NDEBUG)) || HWY_IS_SANITIZER || \
382
+ #if (!defined(__OPTIMIZE__) && !defined(NDEBUG)) || \
383
+ (HWY_IS_ASAN || (HWY_IS_SANITIZER && !HWY_IS_UBSAN)) || \
406
384
  defined(__clang_analyzer__)
407
385
  #define HWY_IS_DEBUG_BUILD 1
408
386
  #else
@@ -455,21 +433,22 @@ HWY_API void CopySameSize(const From* HWY_RESTRICT from, To* HWY_RESTRICT to) {
455
433
  CopyBytes<sizeof(From)>(from, to);
456
434
  }
457
435
 
458
- template <size_t kBytes, typename To>
459
- HWY_API void ZeroBytes(To* to) {
436
+ // Sets each byte to `byte_value`, which must be between 0 and 255.
437
+ HWY_API void FillBytes(void* to, int byte_value, size_t num_bytes) {
460
438
  #if HWY_COMPILER_MSVC
461
- memset(to, 0, kBytes);
439
+ memset(to, byte_value, num_bytes);
462
440
  #else
463
- __builtin_memset(to, 0, kBytes);
441
+ __builtin_memset(to, byte_value, num_bytes);
464
442
  #endif
465
443
  }
466
444
 
467
445
  HWY_API void ZeroBytes(void* to, size_t num_bytes) {
468
- #if HWY_COMPILER_MSVC
469
- memset(to, 0, num_bytes);
470
- #else
471
- __builtin_memset(to, 0, num_bytes);
472
- #endif
446
+ FillBytes(to, 0, num_bytes);
447
+ }
448
+
449
+ template <size_t kBytes, typename To>
450
+ HWY_API void ZeroBytes(To* to) {
451
+ ZeroBytes(to, kBytes);
473
452
  }
474
453
 
475
454
  //------------------------------------------------------------------------------
@@ -1699,28 +1678,14 @@ HWY_F16_CONSTEXPR inline std::partial_ordering operator<=>(
1699
1678
  //------------------------------------------------------------------------------
1700
1679
  // BF16 lane type
1701
1680
 
1702
- // Compiler supports ACLE __bf16, not necessarily with operators.
1703
-
1704
- // Disable the __bf16 type on AArch64 with GCC 13 or earlier as there is a bug
1705
- // in GCC 13 and earlier that sometimes causes BF16 constant values to be
1706
- // incorrectly loaded on AArch64, and this GCC bug on AArch64 is
1707
- // described at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111867.
1708
-
1709
- #if HWY_ARCH_ARM_A64 && \
1710
- (HWY_COMPILER_CLANG >= 1700 || HWY_COMPILER_GCC_ACTUAL >= 1400)
1711
- #define HWY_ARM_HAVE_SCALAR_BF16_TYPE 1
1712
- #else
1713
- #define HWY_ARM_HAVE_SCALAR_BF16_TYPE 0
1714
- #endif
1715
-
1716
1681
  // x86 compiler supports __bf16, not necessarily with operators.
1717
1682
  // Disable in debug builds due to clang miscompiles as of 2025-07-22: casting
1718
1683
  // bf16 <-> f32 in convert_test results in 0x2525 for 1.0 instead of 0x3f80.
1719
1684
  // Reported at https://github.com/llvm/llvm-project/issues/151692.
1720
1685
  #ifndef HWY_SSE2_HAVE_SCALAR_BF16_TYPE
1721
- #if HWY_ARCH_X86 && defined(__SSE2__) && \
1722
- ((HWY_COMPILER_CLANG >= 1700 && !HWY_COMPILER_CLANGCL && \
1723
- !HWY_IS_DEBUG_BUILD) || \
1686
+ #if HWY_ARCH_X86 && defined(__SSE2__) && \
1687
+ ((HWY_COMPILER_CLANG >= 1700 && !HWY_COMPILER_CLANGCL && \
1688
+ (!HWY_IS_DEBUG_BUILD || HWY_COMPILER3_CLANG >= 220101)) || \
1724
1689
  HWY_COMPILER_GCC_ACTUAL >= 1300)
1725
1690
  #define HWY_SSE2_HAVE_SCALAR_BF16_TYPE 1
1726
1691
  #else
@@ -1738,7 +1703,11 @@ HWY_F16_CONSTEXPR inline std::partial_ordering operator<=>(
1738
1703
  #ifndef HWY_HAVE_SCALAR_BF16_OPERATORS
1739
1704
  // Recent enough compiler also has operators. aarch64 clang 18 hits internal
1740
1705
  // compiler errors on bf16 ToString, hence only enable on GCC for now.
1741
- #if HWY_HAVE_SCALAR_BF16_TYPE && (HWY_COMPILER_GCC_ACTUAL >= 1300)
1706
+ // GCC >= 13 will insert a function call to the __extendbfsf2 helper function
1707
+ // for scalar conversions from __bf16 to float. This is prohibitively expensive,
1708
+ // so refrain from using scalar BF16 operators on these compiler versions.
1709
+ // See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121853
1710
+ #if HWY_HAVE_SCALAR_BF16_TYPE && (HWY_COMPILER_GCC_ACTUAL >= 1700)
1742
1711
  #define HWY_HAVE_SCALAR_BF16_OPERATORS 1
1743
1712
  #else
1744
1713
  #define HWY_HAVE_SCALAR_BF16_OPERATORS 0
@@ -2734,7 +2703,7 @@ HWY_API constexpr TTo ConvertScalarTo(TFrom in) {
2734
2703
  template <typename T1, typename T2>
2735
2704
  constexpr inline T1 DivCeil(T1 a, T2 b) {
2736
2705
  #if HWY_CXX_LANG >= 201703L
2737
- HWY_DASSERT(b != 0);
2706
+ HWY_DASSERT(b != T2{0});
2738
2707
  #endif
2739
2708
  return (a + b - 1) / b;
2740
2709
  }
@@ -2957,9 +2926,10 @@ HWY_INLINE constexpr T AddWithWraparound(T t, T2 n) {
2957
2926
  // 64 x 64 = 128 bit multiplication
2958
2927
  HWY_API uint64_t Mul128(uint64_t a, uint64_t b, uint64_t* HWY_RESTRICT upper) {
2959
2928
  #if defined(__SIZEOF_INT128__)
2960
- __uint128_t product = (__uint128_t)a * (__uint128_t)b;
2961
- *upper = (uint64_t)(product >> 64);
2962
- return (uint64_t)(product & 0xFFFFFFFFFFFFFFFFULL);
2929
+ __uint128_t product =
2930
+ static_cast<__uint128_t>(a) * static_cast<__uint128_t>(b);
2931
+ *upper = static_cast<uint64_t>(product >> 64);
2932
+ return static_cast<uint64_t>(product & 0xFFFFFFFFFFFFFFFFULL);
2963
2933
  #elif HWY_COMPILER_MSVC && HWY_ARCH_X86_64
2964
2934
  return _umul128(a, b, upper);
2965
2935
  #else
@@ -2976,9 +2946,9 @@ HWY_API uint64_t Mul128(uint64_t a, uint64_t b, uint64_t* HWY_RESTRICT upper) {
2976
2946
 
2977
2947
  HWY_API int64_t Mul128(int64_t a, int64_t b, int64_t* HWY_RESTRICT upper) {
2978
2948
  #if defined(__SIZEOF_INT128__)
2979
- __int128_t product = (__int128_t)a * (__int128_t)b;
2980
- *upper = (int64_t)(product >> 64);
2981
- return (int64_t)(product & 0xFFFFFFFFFFFFFFFFULL);
2949
+ __int128_t product = static_cast<__int128_t>(a) * static_cast<__int128_t>(b);
2950
+ *upper = static_cast<int64_t>(product >> 64);
2951
+ return static_cast<int64_t>(product & 0xFFFFFFFFFFFFFFFFULL);
2982
2952
  #elif HWY_COMPILER_MSVC && HWY_ARCH_X86_64
2983
2953
  return _mul128(a, b, upper);
2984
2954
  #else