@img/sharp-libvips-dev 1.0.1 → 1.0.2

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 (85) hide show
  1. package/include/expat.h +21 -10
  2. package/include/expat_config.h +11 -5
  3. package/include/ffi.h +12 -25
  4. package/include/freetype2/freetype/config/ftoption.h +1 -1
  5. package/include/gio-unix-2.0/gio/gfiledescriptorbased.h +3 -2
  6. package/include/glib-2.0/gio/gapplication.h +6 -0
  7. package/include/glib-2.0/gio/giotypes.h +0 -1
  8. package/include/glib-2.0/girepository/giarginfo.h +23 -6
  9. package/include/glib-2.0/girepository/gibaseinfo.h +44 -18
  10. package/include/glib-2.0/girepository/gicallableinfo.h +26 -16
  11. package/include/glib-2.0/girepository/gicallbackinfo.h +17 -2
  12. package/include/glib-2.0/girepository/giconstantinfo.h +19 -4
  13. package/include/glib-2.0/girepository/gienuminfo.h +20 -21
  14. package/include/glib-2.0/girepository/gifieldinfo.h +22 -7
  15. package/include/glib-2.0/girepository/giflagsinfo.h +60 -0
  16. package/include/glib-2.0/girepository/gifunctioninfo.h +22 -7
  17. package/include/glib-2.0/girepository/giinterfaceinfo.h +33 -18
  18. package/include/glib-2.0/girepository/giobjectinfo.h +41 -26
  19. package/include/glib-2.0/girepository/gipropertyinfo.h +18 -3
  20. package/include/glib-2.0/girepository/giregisteredtypeinfo.h +22 -11
  21. package/include/glib-2.0/girepository/girepository-autocleanups.h +56 -0
  22. package/include/glib-2.0/girepository/girepository.h +53 -62
  23. package/include/glib-2.0/girepository/girffi.h +8 -7
  24. package/include/glib-2.0/girepository/gisignalinfo.h +18 -3
  25. package/include/glib-2.0/girepository/gistructinfo.h +26 -11
  26. package/include/glib-2.0/girepository/gitypeinfo.h +29 -16
  27. package/include/glib-2.0/girepository/gitypelib.h +9 -13
  28. package/include/glib-2.0/girepository/gitypes.h +52 -104
  29. package/include/glib-2.0/girepository/giunioninfo.h +28 -12
  30. package/include/glib-2.0/girepository/giunresolvedinfo.h +17 -2
  31. package/include/glib-2.0/girepository/givalueinfo.h +65 -0
  32. package/include/glib-2.0/girepository/givfuncinfo.h +23 -8
  33. package/include/glib-2.0/glib/deprecated/gthread.h +9 -5
  34. package/include/glib-2.0/glib/gbitlock.h +31 -0
  35. package/include/glib-2.0/glib/gmessages.h +8 -0
  36. package/include/glib-2.0/glib/gslice.h +2 -0
  37. package/include/glib-2.0/glib/gstrfuncs.h +24 -18
  38. package/include/glib-2.0/glib/gthread.h +191 -3
  39. package/include/glib-2.0/glib-unix.h +7 -1
  40. package/include/glib-2.0/gobject/genums.h +6 -6
  41. package/include/glib-2.0/gobject/glib-types.h +11 -0
  42. package/include/glib-2.0/gobject/gsignal.h +16 -6
  43. package/include/hwy/aligned_allocator.h +171 -6
  44. package/include/hwy/base.h +1765 -543
  45. package/include/hwy/cache_control.h +24 -6
  46. package/include/hwy/detect_compiler_arch.h +23 -2
  47. package/include/hwy/detect_targets.h +56 -13
  48. package/include/hwy/foreach_target.h +24 -0
  49. package/include/hwy/highway.h +20 -3
  50. package/include/hwy/ops/arm_neon-inl.h +1086 -667
  51. package/include/hwy/ops/arm_sve-inl.h +1091 -235
  52. package/include/hwy/ops/emu128-inl.h +271 -196
  53. package/include/hwy/ops/generic_ops-inl.h +2270 -399
  54. package/include/hwy/ops/ppc_vsx-inl.h +1786 -563
  55. package/include/hwy/ops/rvv-inl.h +1043 -311
  56. package/include/hwy/ops/scalar-inl.h +189 -159
  57. package/include/hwy/ops/set_macros-inl.h +66 -6
  58. package/include/hwy/ops/shared-inl.h +175 -56
  59. package/include/hwy/ops/wasm_128-inl.h +153 -136
  60. package/include/hwy/ops/x86_128-inl.h +1647 -646
  61. package/include/hwy/ops/x86_256-inl.h +1003 -370
  62. package/include/hwy/ops/x86_512-inl.h +948 -353
  63. package/include/hwy/per_target.h +4 -0
  64. package/include/hwy/profiler.h +648 -0
  65. package/include/hwy/robust_statistics.h +2 -2
  66. package/include/hwy/targets.h +18 -11
  67. package/include/hwy/timer.h +11 -0
  68. package/include/libpng16/png.h +32 -29
  69. package/include/libpng16/pngconf.h +2 -2
  70. package/include/libpng16/pnglibconf.h +7 -2
  71. package/include/librsvg-2.0/librsvg/rsvg-version.h +2 -2
  72. package/include/libxml2/libxml/parser.h +16 -7
  73. package/include/libxml2/libxml/xmlIO.h +0 -1
  74. package/include/libxml2/libxml/xmlversion.h +4 -4
  75. package/include/pango-1.0/pango/pango-features.h +3 -3
  76. package/include/pango-1.0/pango/pango-fontmap.h +7 -0
  77. package/include/pixman-1/pixman-version.h +2 -2
  78. package/include/png.h +32 -29
  79. package/include/pngconf.h +2 -2
  80. package/include/pnglibconf.h +7 -2
  81. package/include/vips/connection.h +9 -3
  82. package/include/vips/util.h +0 -9
  83. package/include/vips/version.h +4 -4
  84. package/package.json +1 -1
  85. package/versions.json +11 -11
@@ -131,9 +131,21 @@
131
131
  #if HWY_COMPILER_CLANG
132
132
  #define HWY_TARGET_STR_PPC10 HWY_TARGET_STR_PPC9 ",power10-vector"
133
133
  #else
134
- #define HWY_TARGET_STR_PPC10 HWY_TARGET_STR_PPC9 ",cpu=power10"
134
+ // See #1707 and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102059#c35.
135
+ // When the baseline is PPC 8 or 9, inlining functions such as PreventElision
136
+ // into PPC10 code fails because PPC10 defaults to no-htm and is thus worse than
137
+ // the baseline, which has htm. We cannot have pragma target on functions
138
+ // outside HWY_NAMESPACE such as those in base.h. It would be possible for users
139
+ // to set -mno-htm globally, but we can also work around this at the library
140
+ // level by claiming that PPC10 still has HTM, thus avoiding the mismatch. This
141
+ // seems to be safe because HTM uses builtins rather than modifying codegen, see
142
+ // https://gcc.gnu.org/legacy-ml/gcc-patches/2013-07/msg00167.html.
143
+ #define HWY_TARGET_STR_PPC10 HWY_TARGET_STR_PPC9 ",cpu=power10,htm"
135
144
  #endif
136
145
 
146
+ #define HWY_TARGET_STR_Z14 "arch=z14"
147
+ #define HWY_TARGET_STR_Z15 "arch=z15"
148
+
137
149
  // Before include guard so we redefine HWY_TARGET_STR on each include,
138
150
  // governed by the current HWY_TARGET.
139
151
 
@@ -233,7 +245,10 @@
233
245
 
234
246
  #define HWY_HAVE_SCALABLE 0
235
247
  #define HWY_HAVE_INTEGER64 1
236
- #if (HWY_TARGET == HWY_AVX3_SPR) && 0 // TODO(janwas): enable after testing
248
+ #if HWY_TARGET == HWY_AVX3_SPR && HWY_COMPILER_GCC_ACTUAL && \
249
+ HWY_HAVE_SCALAR_F16_TYPE
250
+ // TODO: enable F16 for AVX3_SPR target with Clang once compilation issues are
251
+ // fixed
237
252
  #define HWY_HAVE_FLOAT16 1
238
253
  #else
239
254
  #define HWY_HAVE_FLOAT16 0
@@ -306,6 +321,37 @@
306
321
  #error "Logic error"
307
322
  #endif // HWY_TARGET == HWY_PPC10
308
323
 
324
+ //-----------------------------------------------------------------------------
325
+ // Z14, Z15
326
+ #elif HWY_TARGET == HWY_Z14 || HWY_TARGET == HWY_Z15
327
+
328
+ #define HWY_ALIGN alignas(16)
329
+ #define HWY_MAX_BYTES 16
330
+ #define HWY_LANES(T) (16 / sizeof(T))
331
+
332
+ #define HWY_HAVE_SCALABLE 0
333
+ #define HWY_HAVE_INTEGER64 1
334
+ #define HWY_HAVE_FLOAT16 0
335
+ #define HWY_HAVE_FLOAT64 1
336
+ #define HWY_MEM_OPS_MIGHT_FAULT 1
337
+ #define HWY_NATIVE_FMA 1
338
+ #define HWY_CAP_GE256 0
339
+ #define HWY_CAP_GE512 0
340
+
341
+ #if HWY_TARGET == HWY_Z14
342
+
343
+ #define HWY_NAMESPACE N_Z14
344
+ #define HWY_TARGET_STR HWY_TARGET_STR_Z14
345
+
346
+ #elif HWY_TARGET == HWY_Z15
347
+
348
+ #define HWY_NAMESPACE N_Z15
349
+ #define HWY_TARGET_STR HWY_TARGET_STR_Z15
350
+
351
+ #else
352
+ #error "Logic error"
353
+ #endif // HWY_TARGET == HWY_Z15
354
+
309
355
  //-----------------------------------------------------------------------------
310
356
  // NEON
311
357
  #elif HWY_TARGET == HWY_NEON || HWY_TARGET == HWY_NEON_WITHOUT_AES
@@ -382,7 +428,7 @@
382
428
  #define HWY_LANES(T) ((HWY_MAX_BYTES) / sizeof(T))
383
429
 
384
430
  #define HWY_HAVE_INTEGER64 1
385
- #define HWY_HAVE_FLOAT16 0
431
+ #define HWY_HAVE_FLOAT16 1
386
432
  #define HWY_HAVE_FLOAT64 1
387
433
  #define HWY_MEM_OPS_MIGHT_FAULT 0
388
434
  #define HWY_NATIVE_FMA 1
@@ -410,11 +456,17 @@
410
456
  // Can use pragmas instead of -march compiler flag
411
457
  #if HWY_HAVE_RUNTIME_DISPATCH
412
458
  #if HWY_TARGET == HWY_SVE2 || HWY_TARGET == HWY_SVE2_128
459
+ // Static dispatch with -march=armv8-a+sve2+aes, or no baseline, hence dynamic
460
+ // dispatch, which checks for AES support at runtime.
461
+ #if defined(__ARM_FEATURE_SVE2_AES) || (HWY_BASELINE_SVE2 == 0)
413
462
  #define HWY_TARGET_STR "+sve2-aes"
414
- #else
463
+ #else // SVE2 without AES
464
+ #define HWY_TARGET_STR "+sve2"
465
+ #endif
466
+ #else // not SVE2 target
415
467
  #define HWY_TARGET_STR "+sve"
416
468
  #endif
417
- #else
469
+ #else // !HWY_HAVE_RUNTIME_DISPATCH
418
470
  // HWY_TARGET_STR remains undefined
419
471
  #endif
420
472
 
@@ -483,7 +535,7 @@
483
535
  #define HWY_CAP_GE256 0
484
536
  #define HWY_CAP_GE512 0
485
537
 
486
- #if defined(__riscv_zvfh)
538
+ #if HWY_RVV_HAVE_F16_VEC
487
539
  #define HWY_HAVE_FLOAT16 1
488
540
  #else
489
541
  #define HWY_HAVE_FLOAT16 0
@@ -540,6 +592,14 @@
540
592
  #pragma message("HWY_TARGET does not match any known target")
541
593
  #endif // HWY_TARGET
542
594
 
595
+ //-----------------------------------------------------------------------------
596
+
597
+ // Sanity check: if we have f16 vector support, then base.h should also be
598
+ // using a built-in type for f16 scalars.
599
+ #if HWY_HAVE_FLOAT16 && !HWY_HAVE_SCALAR_F16_TYPE
600
+ #error "Logic error: f16 vectors but no scalars"
601
+ #endif
602
+
543
603
  // Override this to 1 in asan/msan builds, which will still fault.
544
604
  #if HWY_IS_ASAN || HWY_IS_MSAN
545
605
  #undef HWY_MEM_OPS_MIGHT_FAULT
@@ -38,7 +38,9 @@
38
38
 
39
39
  // We are covered by the highway.h include guard, but generic_ops-inl.h
40
40
  // includes this again #if HWY_IDE.
41
- #if defined(HIGHWAY_HWY_OPS_SHARED_TOGGLE) == defined(HWY_TARGET_TOGGLE)
41
+ // clang-format off
42
+ #if defined(HIGHWAY_HWY_OPS_SHARED_TOGGLE) == defined(HWY_TARGET_TOGGLE) // NOLINT
43
+ // clang-format on
42
44
  #ifdef HIGHWAY_HWY_OPS_SHARED_TOGGLE
43
45
  #undef HIGHWAY_HWY_OPS_SHARED_TOGGLE
44
46
  #else
@@ -69,27 +71,75 @@ using VecArg = V;
69
71
 
70
72
  namespace detail {
71
73
 
72
- // Primary template: default is no change for all but f16.
73
74
  template <typename T>
74
75
  struct NativeLaneTypeT {
75
76
  using type = T;
76
77
  };
77
-
78
78
  template <>
79
79
  struct NativeLaneTypeT<hwy::float16_t> {
80
- using type = hwy::float16_t::Raw;
80
+ #if HWY_HAVE_SCALAR_F16_TYPE
81
+ using type = hwy::float16_t::Native;
82
+ #else
83
+ using type = uint16_t;
84
+ #endif
81
85
  };
82
-
83
86
  template <>
84
87
  struct NativeLaneTypeT<hwy::bfloat16_t> {
85
- using type = hwy::bfloat16_t::Raw;
88
+ #if HWY_HAVE_SCALAR_BF16_TYPE
89
+ using type = hwy::bfloat16_t::Native;
90
+ #else
91
+ using type = uint16_t;
92
+ #endif
86
93
  };
87
94
 
88
- // Evaluates to the type expected by intrinsics given the Highway lane type T.
89
- // This is usually the same, but differs for our wrapper types [b]float16_t.
95
+ // The type expected by intrinsics for the given Highway lane type T. This
96
+ // usually matches T, but differs for our wrapper types [b]float16_t. Use this
97
+ // only when defining intrinsic wrappers, and NOT for casting, which is UB.
90
98
  template <typename T>
91
99
  using NativeLaneType = typename NativeLaneTypeT<T>::type;
92
100
 
101
+ // Returns the same pointer after changing type to NativeLaneType. Use this only
102
+ // for wrapper functions that call intrinsics (e.g. load/store) where some of
103
+ // the overloads expect _Float16* or __bf16* arguments. For non-special floats,
104
+ // this returns the same pointer and type.
105
+ //
106
+ // This makes use of the fact that a wrapper struct is pointer-interconvertible
107
+ // with its first member (a union), thus also with the union members. Do NOT
108
+ // call both this and U16LanePointer on the same object - they access different
109
+ // union members, and this is not guaranteed to be safe.
110
+ template <typename T, HWY_IF_NOT_SPECIAL_FLOAT(T)>
111
+ HWY_INLINE T* NativeLanePointer(T* p) {
112
+ return p;
113
+ }
114
+ template <typename T, typename NT = NativeLaneType<RemoveConst<T>>,
115
+ HWY_IF_F16(T)>
116
+ HWY_INLINE constexpr If<IsConst<T>(), const NT*, NT*> NativeLanePointer(T* p) {
117
+ #if HWY_HAVE_SCALAR_F16_TYPE
118
+ return &p->native;
119
+ #else
120
+ return &p->bits;
121
+ #endif
122
+ }
123
+ template <typename T, typename NT = NativeLaneType<RemoveConst<T>>,
124
+ HWY_IF_BF16(T)>
125
+ HWY_INLINE constexpr If<IsConst<T>(), const NT*, NT*> NativeLanePointer(T* p) {
126
+ #if HWY_HAVE_SCALAR_BF16_TYPE
127
+ return &p->native;
128
+ #else
129
+ return &p->bits;
130
+ #endif
131
+ }
132
+
133
+ // Returns a pointer to the u16 member of our [b]float16_t wrapper structs.
134
+ // Use this in Highway targets that lack __bf16 intrinsics; for storing to
135
+ // memory, we BitCast vectors to u16 and write to the pointer returned here.
136
+ // Do NOT call both this and U16LanePointer on the same object - they access
137
+ // different union members, and this is not guaranteed to be safe.
138
+ template <typename T, HWY_IF_SPECIAL_FLOAT(T)>
139
+ HWY_INLINE If<IsConst<T>(), const uint16_t*, uint16_t*> U16LanePointer(T* p) {
140
+ return &p->bits;
141
+ }
142
+
93
143
  // Returns N * 2^pow2. N is the number of lanes in a full vector and pow2 the
94
144
  // desired fraction or multiple of it, see Simd<>. `pow2` is most often in
95
145
  // [-3, 3] but can also be lower for user-specified fractions.
@@ -151,6 +201,13 @@ struct Simd {
151
201
 
152
202
  private:
153
203
  static_assert(sizeof(Lane) <= 8, "Lanes are up to 64-bit");
204
+ static_assert(IsSame<Lane, RemoveCvRef<Lane>>(),
205
+ "Lane must not be a reference type, const-qualified type, or "
206
+ "volatile-qualified type");
207
+ static_assert(IsIntegerLaneType<Lane>() || IsFloat<Lane>() ||
208
+ IsSpecialFloat<Lane>(),
209
+ "IsIntegerLaneType<T>(), IsFloat<T>(), or IsSpecialFloat<T>() "
210
+ "must be true");
154
211
  // 20 bits are sufficient for any HWY_MAX_BYTES. This is the 'normal' value of
155
212
  // N when kFrac == 0, otherwise it is one (see FracN).
156
213
  static constexpr size_t kWhole = N & 0xFFFFF;
@@ -185,11 +242,14 @@ struct Simd {
185
242
  // macro required by MSVC.
186
243
  static constexpr size_t kPrivateLanes =
187
244
  HWY_MAX(size_t{1}, detail::ScaleByPower(kWhole, kPow2 - kFrac));
245
+ // Do not use this directly - only 'public' so it is visible from the accessor
246
+ // macro required by MSVC.
247
+ static constexpr int kPrivatePow2 = kPow2;
188
248
 
189
249
  constexpr size_t MaxLanes() const { return kPrivateLanes; }
190
250
  constexpr size_t MaxBytes() const { return kPrivateLanes * sizeof(Lane); }
191
251
  constexpr size_t MaxBlocks() const { return (MaxBytes() + 15) / 16; }
192
- // For SFINAE on RVV.
252
+ // For SFINAE (HWY_IF_POW2_GT_D).
193
253
  constexpr int Pow2() const { return kPow2; }
194
254
 
195
255
  // ------------------------------ Changing lane type or count
@@ -371,6 +431,10 @@ using TFromD = typename D::T;
371
431
  // MSVC workaround: use static constant directly instead of a function.
372
432
  #define HWY_MAX_LANES_D(D) D::kPrivateLanes
373
433
 
434
+ // Same as D().Pow2(), but this is too complex for SFINAE with MSVC, so we use a
435
+ // static constant directly.
436
+ #define HWY_POW2_D(D) D::kPrivatePow2
437
+
374
438
  // Non-macro form of HWY_MAX_LANES_D in case that is preferable. WARNING: the
375
439
  // macro form may be required for MSVC, which has limitations on deducing
376
440
  // arguments.
@@ -411,6 +475,13 @@ using RepartitionToWide = Repartition<MakeWide<TFromD<D>>, D>;
411
475
  template <class D>
412
476
  using RepartitionToNarrow = Repartition<MakeNarrow<TFromD<D>>, D>;
413
477
 
478
+ // Shorthand for applying RepartitionToWide twice (for 8/16-bit types).
479
+ template <class D>
480
+ using RepartitionToWideX2 = RepartitionToWide<RepartitionToWide<D>>;
481
+ // Shorthand for applying RepartitionToWide three times (for 8-bit types).
482
+ template <class D>
483
+ using RepartitionToWideX3 = RepartitionToWide<RepartitionToWideX2<D>>;
484
+
414
485
  // Tag for the same lane type as D, but half the lanes.
415
486
  template <class D>
416
487
  using Half = typename D::Half;
@@ -447,85 +518,133 @@ using BlockDFromD =
447
518
  Simd<TFromD<D>, HWY_MIN(16 / sizeof(TFromD<D>), HWY_MAX_LANES_D(D)), 0>;
448
519
  #endif
449
520
 
521
+ // Returns whether `ptr` is a multiple of `Lanes(d)` elements.
522
+ template <class D, typename T>
523
+ HWY_API bool IsAligned(D d, T* ptr) {
524
+ const size_t N = Lanes(d);
525
+ return reinterpret_cast<uintptr_t>(ptr) % (N * sizeof(T)) == 0;
526
+ }
527
+
450
528
  // ------------------------------ Choosing overloads (SFINAE)
451
529
 
452
530
  // Same as base.h macros but with a Simd<T, N, kPow2> argument instead of T.
453
- #define HWY_IF_UNSIGNED_D(D) HWY_IF_UNSIGNED(TFromD<D>)
454
- #define HWY_IF_SIGNED_D(D) HWY_IF_SIGNED(TFromD<D>)
455
- #define HWY_IF_FLOAT_D(D) HWY_IF_FLOAT(TFromD<D>)
456
- #define HWY_IF_NOT_FLOAT_D(D) HWY_IF_NOT_FLOAT(TFromD<D>)
457
- #define HWY_IF_FLOAT3264_D(D) HWY_IF_FLOAT3264(TFromD<D>)
458
- #define HWY_IF_NOT_FLOAT3264_D(D) HWY_IF_NOT_FLOAT3264(TFromD<D>)
459
- #define HWY_IF_SPECIAL_FLOAT_D(D) HWY_IF_SPECIAL_FLOAT(TFromD<D>)
460
- #define HWY_IF_NOT_SPECIAL_FLOAT_D(D) HWY_IF_NOT_SPECIAL_FLOAT(TFromD<D>)
461
- #define HWY_IF_FLOAT_OR_SPECIAL_D(D) HWY_IF_FLOAT_OR_SPECIAL(TFromD<D>)
531
+ #define HWY_IF_UNSIGNED_D(D) HWY_IF_UNSIGNED(hwy::HWY_NAMESPACE::TFromD<D>)
532
+ #define HWY_IF_SIGNED_D(D) HWY_IF_SIGNED(hwy::HWY_NAMESPACE::TFromD<D>)
533
+ #define HWY_IF_FLOAT_D(D) HWY_IF_FLOAT(hwy::HWY_NAMESPACE::TFromD<D>)
534
+ #define HWY_IF_NOT_FLOAT_D(D) HWY_IF_NOT_FLOAT(hwy::HWY_NAMESPACE::TFromD<D>)
535
+ #define HWY_IF_FLOAT3264_D(D) HWY_IF_FLOAT3264(hwy::HWY_NAMESPACE::TFromD<D>)
536
+ #define HWY_IF_NOT_FLOAT3264_D(D) \
537
+ HWY_IF_NOT_FLOAT3264(hwy::HWY_NAMESPACE::TFromD<D>)
538
+ #define HWY_IF_SPECIAL_FLOAT_D(D) \
539
+ HWY_IF_SPECIAL_FLOAT(hwy::HWY_NAMESPACE::TFromD<D>)
540
+ #define HWY_IF_NOT_SPECIAL_FLOAT_D(D) \
541
+ HWY_IF_NOT_SPECIAL_FLOAT(hwy::HWY_NAMESPACE::TFromD<D>)
542
+ #define HWY_IF_FLOAT_OR_SPECIAL_D(D) \
543
+ HWY_IF_FLOAT_OR_SPECIAL(hwy::HWY_NAMESPACE::TFromD<D>)
462
544
  #define HWY_IF_NOT_FLOAT_NOR_SPECIAL_D(D) \
463
- HWY_IF_NOT_FLOAT_NOR_SPECIAL(TFromD<D>)
545
+ HWY_IF_NOT_FLOAT_NOR_SPECIAL(hwy::HWY_NAMESPACE::TFromD<D>)
464
546
 
465
- #define HWY_IF_T_SIZE_D(D, bytes) HWY_IF_T_SIZE(TFromD<D>, bytes)
466
- #define HWY_IF_NOT_T_SIZE_D(D, bytes) HWY_IF_NOT_T_SIZE(TFromD<D>, bytes)
547
+ #define HWY_IF_T_SIZE_D(D, bytes) \
548
+ HWY_IF_T_SIZE(hwy::HWY_NAMESPACE::TFromD<D>, bytes)
549
+ #define HWY_IF_NOT_T_SIZE_D(D, bytes) \
550
+ HWY_IF_NOT_T_SIZE(hwy::HWY_NAMESPACE::TFromD<D>, bytes)
467
551
  #define HWY_IF_T_SIZE_ONE_OF_D(D, bit_array) \
468
- HWY_IF_T_SIZE_ONE_OF(TFromD<D>, bit_array)
552
+ HWY_IF_T_SIZE_ONE_OF(hwy::HWY_NAMESPACE::TFromD<D>, bit_array)
553
+ #define HWY_IF_T_SIZE_LE_D(D, bytes) \
554
+ HWY_IF_T_SIZE_LE(hwy::HWY_NAMESPACE::TFromD<D>, bytes)
555
+ #define HWY_IF_T_SIZE_GT_D(D, bytes) \
556
+ HWY_IF_T_SIZE_GT(hwy::HWY_NAMESPACE::TFromD<D>, bytes)
469
557
 
470
558
  #define HWY_IF_LANES_D(D, lanes) HWY_IF_LANES(HWY_MAX_LANES_D(D), lanes)
471
559
  #define HWY_IF_LANES_LE_D(D, lanes) HWY_IF_LANES_LE(HWY_MAX_LANES_D(D), lanes)
472
560
  #define HWY_IF_LANES_GT_D(D, lanes) HWY_IF_LANES_GT(HWY_MAX_LANES_D(D), lanes)
473
- #define HWY_IF_LANES_PER_BLOCK_D(D, lanes) \
474
- HWY_IF_LANES_PER_BLOCK( \
475
- TFromD<D>, HWY_MIN(HWY_MAX_LANES_D(D), 16 / sizeof(TFromD<D>)), lanes)
476
-
561
+ #define HWY_IF_LANES_PER_BLOCK_D(D, lanes) \
562
+ HWY_IF_LANES_PER_BLOCK(hwy::HWY_NAMESPACE::TFromD<D>, HWY_MAX_LANES_D(D), \
563
+ lanes)
564
+
565
+ #if HWY_COMPILER_MSVC
566
+ #define HWY_IF_POW2_LE_D(D, pow2) \
567
+ hwy::EnableIf<HWY_POW2_D(D) <= pow2>* = nullptr
568
+ #define HWY_IF_POW2_GT_D(D, pow2) \
569
+ hwy::EnableIf<(HWY_POW2_D(D) > pow2)>* = nullptr
570
+ #else
477
571
  #define HWY_IF_POW2_LE_D(D, pow2) hwy::EnableIf<D().Pow2() <= pow2>* = nullptr
478
572
  #define HWY_IF_POW2_GT_D(D, pow2) hwy::EnableIf<(D().Pow2() > pow2)>* = nullptr
573
+ #endif // HWY_COMPILER_MSVC
479
574
 
480
- #define HWY_IF_U8_D(D) hwy::EnableIf<IsSame<TFromD<D>, uint8_t>()>* = nullptr
481
- #define HWY_IF_U16_D(D) hwy::EnableIf<IsSame<TFromD<D>, uint16_t>()>* = nullptr
482
- #define HWY_IF_U32_D(D) hwy::EnableIf<IsSame<TFromD<D>, uint32_t>()>* = nullptr
483
- #define HWY_IF_U64_D(D) hwy::EnableIf<IsSame<TFromD<D>, uint64_t>()>* = nullptr
575
+ #define HWY_IF_U8_D(D) HWY_IF_U8(hwy::HWY_NAMESPACE::TFromD<D>)
576
+ #define HWY_IF_U16_D(D) HWY_IF_U16(hwy::HWY_NAMESPACE::TFromD<D>)
577
+ #define HWY_IF_U32_D(D) HWY_IF_U32(hwy::HWY_NAMESPACE::TFromD<D>)
578
+ #define HWY_IF_U64_D(D) HWY_IF_U64(hwy::HWY_NAMESPACE::TFromD<D>)
484
579
 
485
- #define HWY_IF_I8_D(D) hwy::EnableIf<IsSame<TFromD<D>, int8_t>()>* = nullptr
486
- #define HWY_IF_I16_D(D) hwy::EnableIf<IsSame<TFromD<D>, int16_t>()>* = nullptr
487
- #define HWY_IF_I32_D(D) hwy::EnableIf<IsSame<TFromD<D>, int32_t>()>* = nullptr
488
- #define HWY_IF_I64_D(D) hwy::EnableIf<IsSame<TFromD<D>, int64_t>()>* = nullptr
580
+ #define HWY_IF_I8_D(D) HWY_IF_I8(hwy::HWY_NAMESPACE::TFromD<D>)
581
+ #define HWY_IF_I16_D(D) HWY_IF_I16(hwy::HWY_NAMESPACE::TFromD<D>)
582
+ #define HWY_IF_I32_D(D) HWY_IF_I32(hwy::HWY_NAMESPACE::TFromD<D>)
583
+ #define HWY_IF_I64_D(D) HWY_IF_I64(hwy::HWY_NAMESPACE::TFromD<D>)
489
584
 
490
585
  // Use instead of HWY_IF_T_SIZE_D to avoid ambiguity with float16_t/float/double
491
586
  // overloads.
492
- #define HWY_IF_UI16_D(D) HWY_IF_UI16(TFromD<D>)
493
- #define HWY_IF_UI32_D(D) HWY_IF_UI32(TFromD<D>)
494
- #define HWY_IF_UI64_D(D) HWY_IF_UI64(TFromD<D>)
587
+ #define HWY_IF_UI8_D(D) HWY_IF_UI8(hwy::HWY_NAMESPACE::TFromD<D>)
588
+ #define HWY_IF_UI16_D(D) HWY_IF_UI16(hwy::HWY_NAMESPACE::TFromD<D>)
589
+ #define HWY_IF_UI32_D(D) HWY_IF_UI32(hwy::HWY_NAMESPACE::TFromD<D>)
590
+ #define HWY_IF_UI64_D(D) HWY_IF_UI64(hwy::HWY_NAMESPACE::TFromD<D>)
591
+
592
+ #define HWY_IF_BF16_D(D) HWY_IF_BF16(hwy::HWY_NAMESPACE::TFromD<D>)
593
+ #define HWY_IF_NOT_BF16_D(D) HWY_IF_NOT_BF16(hwy::HWY_NAMESPACE::TFromD<D>)
495
594
 
496
- #define HWY_IF_BF16_D(D) HWY_IF_BF16(TFromD<D>)
497
- #define HWY_IF_F16_D(D) HWY_IF_F16(TFromD<D>)
498
- #define HWY_IF_F32_D(D) hwy::EnableIf<IsSame<TFromD<D>, float>()>* = nullptr
499
- #define HWY_IF_F64_D(D) hwy::EnableIf<IsSame<TFromD<D>, double>()>* = nullptr
595
+ #define HWY_IF_F16_D(D) HWY_IF_F16(hwy::HWY_NAMESPACE::TFromD<D>)
596
+ #define HWY_IF_NOT_F16_D(D) HWY_IF_NOT_F16(hwy::HWY_NAMESPACE::TFromD<D>)
500
597
 
598
+ #define HWY_IF_F32_D(D) HWY_IF_F32(hwy::HWY_NAMESPACE::TFromD<D>)
599
+ #define HWY_IF_F64_D(D) HWY_IF_F64(hwy::HWY_NAMESPACE::TFromD<D>)
600
+
601
+ #define HWY_V_SIZE_D(D) \
602
+ (HWY_MAX_LANES_D(D) * sizeof(hwy::HWY_NAMESPACE::TFromD<D>))
501
603
  #define HWY_IF_V_SIZE_D(D, bytes) \
502
- HWY_IF_V_SIZE(TFromD<D>, HWY_MAX_LANES_D(D), bytes)
604
+ HWY_IF_V_SIZE(hwy::HWY_NAMESPACE::TFromD<D>, HWY_MAX_LANES_D(D), bytes)
503
605
  #define HWY_IF_V_SIZE_LE_D(D, bytes) \
504
- HWY_IF_V_SIZE_LE(TFromD<D>, HWY_MAX_LANES_D(D), bytes)
606
+ HWY_IF_V_SIZE_LE(hwy::HWY_NAMESPACE::TFromD<D>, HWY_MAX_LANES_D(D), bytes)
505
607
  #define HWY_IF_V_SIZE_GT_D(D, bytes) \
506
- HWY_IF_V_SIZE_GT(TFromD<D>, HWY_MAX_LANES_D(D), bytes)
608
+ HWY_IF_V_SIZE_GT(hwy::HWY_NAMESPACE::TFromD<D>, HWY_MAX_LANES_D(D), bytes)
507
609
 
508
610
  // Same, but with a vector argument. ops/*-inl.h define their own TFromV.
509
- #define HWY_IF_UNSIGNED_V(V) HWY_IF_UNSIGNED(TFromV<V>)
510
- #define HWY_IF_SIGNED_V(V) HWY_IF_SIGNED(TFromV<V>)
511
- #define HWY_IF_FLOAT_V(V) HWY_IF_FLOAT(TFromV<V>)
512
- #define HWY_IF_NOT_FLOAT_V(V) HWY_IF_NOT_FLOAT(TFromV<V>)
513
- #define HWY_IF_SPECIAL_FLOAT_V(V) HWY_IF_SPECIAL_FLOAT(TFromV<V>)
611
+ #define HWY_IF_UNSIGNED_V(V) HWY_IF_UNSIGNED(hwy::HWY_NAMESPACE::TFromV<V>)
612
+ #define HWY_IF_SIGNED_V(V) HWY_IF_SIGNED(hwy::HWY_NAMESPACE::TFromV<V>)
613
+ #define HWY_IF_FLOAT_V(V) HWY_IF_FLOAT(hwy::HWY_NAMESPACE::TFromV<V>)
614
+ #define HWY_IF_NOT_FLOAT_V(V) HWY_IF_NOT_FLOAT(hwy::HWY_NAMESPACE::TFromV<V>)
615
+ #define HWY_IF_SPECIAL_FLOAT_V(V) \
616
+ HWY_IF_SPECIAL_FLOAT(hwy::HWY_NAMESPACE::TFromV<V>)
514
617
  #define HWY_IF_NOT_FLOAT_NOR_SPECIAL_V(V) \
515
- HWY_IF_NOT_FLOAT_NOR_SPECIAL(TFromV<V>)
618
+ HWY_IF_NOT_FLOAT_NOR_SPECIAL(hwy::HWY_NAMESPACE::TFromV<V>)
516
619
 
517
- #define HWY_IF_T_SIZE_V(V, bytes) HWY_IF_T_SIZE(TFromV<V>, bytes)
518
- #define HWY_IF_NOT_T_SIZE_V(V, bytes) HWY_IF_NOT_T_SIZE(TFromV<V>, bytes)
620
+ #define HWY_IF_T_SIZE_V(V, bytes) \
621
+ HWY_IF_T_SIZE(hwy::HWY_NAMESPACE::TFromV<V>, bytes)
622
+ #define HWY_IF_NOT_T_SIZE_V(V, bytes) \
623
+ HWY_IF_NOT_T_SIZE(hwy::HWY_NAMESPACE::TFromV<V>, bytes)
519
624
  #define HWY_IF_T_SIZE_ONE_OF_V(V, bit_array) \
520
- HWY_IF_T_SIZE_ONE_OF(TFromV<V>, bit_array)
625
+ HWY_IF_T_SIZE_ONE_OF(hwy::HWY_NAMESPACE::TFromV<V>, bit_array)
521
626
 
522
627
  #define HWY_MAX_LANES_V(V) HWY_MAX_LANES_D(DFromV<V>)
523
628
  #define HWY_IF_V_SIZE_V(V, bytes) \
524
- HWY_IF_V_SIZE(TFromV<V>, HWY_MAX_LANES_V(V), bytes)
629
+ HWY_IF_V_SIZE(hwy::HWY_NAMESPACE::TFromV<V>, HWY_MAX_LANES_V(V), bytes)
525
630
  #define HWY_IF_V_SIZE_LE_V(V, bytes) \
526
- HWY_IF_V_SIZE_LE(TFromV<V>, HWY_MAX_LANES_V(V), bytes)
631
+ HWY_IF_V_SIZE_LE(hwy::HWY_NAMESPACE::TFromV<V>, HWY_MAX_LANES_V(V), bytes)
527
632
  #define HWY_IF_V_SIZE_GT_V(V, bytes) \
528
- HWY_IF_V_SIZE_GT(TFromV<V>, HWY_MAX_LANES_V(V), bytes)
633
+ HWY_IF_V_SIZE_GT(hwy::HWY_NAMESPACE::TFromV<V>, HWY_MAX_LANES_V(V), bytes)
634
+
635
+ // Use in implementations of ReduceSum etc. to avoid conflicts with the N=1 and
636
+ // N=4 8-bit specializations in generic_ops-inl.
637
+ #undef HWY_IF_REDUCE_D
638
+ #define HWY_IF_REDUCE_D(D) \
639
+ hwy::EnableIf<HWY_MAX_LANES_D(D) != 1 && \
640
+ (HWY_MAX_LANES_D(D) != 4 || \
641
+ sizeof(hwy::HWY_NAMESPACE::TFromD<D>) != 1)>* = nullptr
642
+
643
+ #undef HWY_IF_SUM_OF_LANES_D
644
+ #define HWY_IF_SUM_OF_LANES_D(D) HWY_IF_LANES_GT_D(D, 1)
645
+
646
+ #undef HWY_IF_MINMAX_OF_LANES_D
647
+ #define HWY_IF_MINMAX_OF_LANES_D(D) HWY_IF_LANES_GT_D(D, 1)
529
648
 
530
649
  // Old names (deprecated)
531
650
  #define HWY_IF_LANE_SIZE_D(D, bytes) HWY_IF_T_SIZE_D(D, bytes)