@zigc/lib 0.17.0-dev.215 → 0.17.0-dev.228

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 (75) hide show
  1. package/c/math.zig +31 -2
  2. package/compiler/resinator/compile.zig +1 -1
  3. package/compiler_rt/cos.zig +1 -1
  4. package/compiler_rt/rem_pio2l.zig +1 -1
  5. package/compiler_rt/sin.zig +1 -1
  6. package/compiler_rt/sincos.zig +1 -1
  7. package/compiler_rt/tan.zig +1 -1
  8. package/libcxx/libc/hdr/errno_macros.h +3 -1
  9. package/libcxx/libc/hdr/stdint_proxy.h +18 -0
  10. package/libcxx/libc/hdr/types/wchar_t.h +23 -0
  11. package/libcxx/libc/hdr/wchar_overlay.h +69 -0
  12. package/libcxx/libc/include/llvm-libc-macros/cfloat128-macros.h +41 -0
  13. package/libcxx/libc/include/llvm-libc-macros/cfloat16-macros.h +20 -0
  14. package/libcxx/libc/include/llvm-libc-macros/wchar-macros.h +18 -0
  15. package/libcxx/libc/include/llvm-libc-types/cfloat128.h +11 -28
  16. package/libcxx/libc/include/llvm-libc-types/cfloat16.h +4 -7
  17. package/libcxx/libc/include/llvm-libc-types/wint_t.h +14 -0
  18. package/libcxx/libc/shared/libc_common.h +5 -0
  19. package/libcxx/libc/src/__support/CPP/bit.h +50 -12
  20. package/libcxx/libc/src/__support/CPP/type_traits/is_complex.h +7 -0
  21. package/libcxx/libc/src/__support/CPP/type_traits/is_destructible.h +2 -1
  22. package/libcxx/libc/src/__support/CPP/type_traits/is_unsigned.h +6 -0
  23. package/libcxx/libc/src/__support/CPP/utility/integer_sequence.h +10 -0
  24. package/libcxx/libc/src/__support/FPUtil/FPBits.h +6 -7
  25. package/libcxx/libc/src/__support/FPUtil/rounding_mode.h +50 -4
  26. package/libcxx/libc/src/__support/big_int.h +14 -14
  27. package/libcxx/libc/src/__support/common.h +3 -2
  28. package/libcxx/libc/src/__support/ctype_utils.h +19 -12
  29. package/libcxx/libc/src/__support/detailed_powers_of_ten.h +1 -2
  30. package/libcxx/libc/src/__support/high_precision_decimal.h +33 -14
  31. package/libcxx/libc/src/__support/libc_assert.h +2 -0
  32. package/libcxx/libc/src/__support/macros/attributes.h +44 -1
  33. package/libcxx/libc/src/__support/macros/config.h +23 -0
  34. package/libcxx/libc/src/__support/macros/null_check.h +1 -2
  35. package/libcxx/libc/src/__support/macros/optimization.h +3 -0
  36. package/libcxx/libc/src/__support/macros/properties/architectures.h +5 -1
  37. package/libcxx/libc/src/__support/macros/properties/compiler.h +8 -3
  38. package/libcxx/libc/src/__support/macros/properties/cpu_features.h +17 -1
  39. package/libcxx/libc/src/__support/macros/properties/types.h +2 -3
  40. package/libcxx/libc/src/__support/macros/sanitizer.h +0 -10
  41. package/libcxx/libc/src/__support/math_extras.h +20 -4
  42. package/libcxx/libc/src/__support/str_to_float.h +98 -125
  43. package/libcxx/libc/src/__support/str_to_integer.h +39 -27
  44. package/libcxx/libc/src/__support/wctype_utils.h +588 -0
  45. package/libunwind/src/AddressSpace.hpp +2 -1
  46. package/libunwind/src/DwarfParser.hpp +2 -1
  47. package/package.json +1 -1
  48. package/std/Build/Step/ConfigHeader.zig +1 -1
  49. package/std/Io/Kqueue.zig +1 -1
  50. package/std/Target.zig +5 -6
  51. package/std/bit_set.zig +76 -59
  52. package/std/c.zig +2 -2
  53. package/std/crypto/codecs/base64_hex_ct.zig +1 -1
  54. package/std/crypto/ml_kem.zig +0 -15
  55. package/std/enums.zig +2 -2
  56. package/std/fs/path.zig +1 -1
  57. package/std/math/float.zig +62 -0
  58. package/std/math/modf.zig +1 -1
  59. package/std/math.zig +1 -0
  60. package/std/std.zig +3 -0
  61. package/std/testing.zig +1 -1
  62. package/std/zig/target.zig +1 -2
  63. package/std/zon/parse.zig +1 -1
  64. package/compiler_rt/long_double.zig +0 -37
  65. package/libc/mingw/math/lrintl.c +0 -18
  66. package/libc/mingw/math/rintl.c +0 -16
  67. package/libc/musl/src/math/i386/lrintl.c +0 -8
  68. package/libc/musl/src/math/i386/rintl.c +0 -7
  69. package/libc/musl/src/math/lrintl.c +0 -36
  70. package/libc/musl/src/math/rintl.c +0 -29
  71. package/libc/musl/src/math/s390x/rintl.c +0 -15
  72. package/libc/musl/src/math/x32/lrintl.s +0 -7
  73. package/libc/musl/src/math/x32/rintl.s +0 -6
  74. package/libc/musl/src/math/x86_64/lrintl.c +0 -8
  75. package/libc/musl/src/math/x86_64/rintl.c +0 -7
package/std/bit_set.zig CHANGED
@@ -8,50 +8,55 @@
8
8
  //!
9
9
  //! There are five variants defined here:
10
10
  //!
11
- //! IntegerBitSet:
11
+ //! Integer:
12
12
  //! A bit set with static size, which is backed by a single integer.
13
13
  //! This set is good for sets with a small size, but may generate
14
14
  //! inefficient code for larger sets, especially in debug mode.
15
15
  //!
16
- //! ArrayBitSet:
16
+ //! Array:
17
17
  //! A bit set with static size, which is backed by an array of usize.
18
18
  //! This set is good for sets with a larger size, but may use
19
19
  //! more bytes than necessary if your set is small.
20
20
  //!
21
- //! StaticBitSet:
22
- //! Picks either IntegerBitSet or ArrayBitSet depending on the requested
21
+ //! Static:
22
+ //! Picks either Integer or Array depending on the requested
23
23
  //! size. The interfaces of these two types match exactly, except for fields.
24
24
  //!
25
- //! DynamicBitSet:
25
+ //! Dynamic:
26
26
  //! A bit set with runtime-known size, backed by an allocated slice
27
27
  //! of usize.
28
28
  //!
29
- //! DynamicBitSetUnmanaged:
30
- //! A variant of DynamicBitSet which does not store a pointer to its
31
- //! allocator, in order to save space.
29
+ //! DynamicManaged:
30
+ //! A variant of Dynamic which stores an allocator, using it when needed.
32
31
 
33
32
  const std = @import("std.zig");
34
33
  const assert = std.debug.assert;
35
34
  const Allocator = std.mem.Allocator;
36
35
  const builtin = @import("builtin");
37
36
 
37
+ /// Deprecated: use `Static`.
38
+ pub const StaticBitSet = Static;
39
+
38
40
  /// Returns the optimal static bit set type for the specified number
39
41
  /// of elements: either `IntegerBitSet` or `ArrayBitSet`,
40
42
  /// both of which fulfill the same interface.
41
43
  /// The returned type will perform no allocations,
42
44
  /// can be copied by value, and does not require deinitialization.
43
- pub fn StaticBitSet(comptime size: usize) type {
45
+ pub fn Static(comptime size: usize) type {
44
46
  if (size <= @bitSizeOf(usize)) {
45
- return IntegerBitSet(size);
47
+ return Integer(size);
46
48
  } else {
47
- return ArrayBitSet(usize, size);
49
+ return Array(usize, size);
48
50
  }
49
51
  }
50
52
 
53
+ /// Deprecated: use `Integer`.
54
+ pub const IntegerBitSet = Integer;
55
+
51
56
  /// A bit set with static size, which is backed by a single integer.
52
57
  /// This set is good for sets with a small size, but may generate
53
58
  /// inefficient code for larger sets, especially in debug mode.
54
- pub fn IntegerBitSet(comptime size: u16) type {
59
+ pub fn Integer(comptime size: u16) type {
55
60
  return packed struct(MaskInt) {
56
61
  const Self = @This();
57
62
 
@@ -328,21 +333,24 @@ pub fn IntegerBitSet(comptime size: u16) type {
328
333
  };
329
334
  }
330
335
 
336
+ /// Deprecated: use `Array`.
337
+ pub const ArrayBitSet = Array;
338
+
331
339
  /// A bit set with static size, which is backed by an array of usize.
332
340
  /// This set is good for sets with a larger size, but may use
333
341
  /// more bytes than necessary if your set is small.
334
- pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type {
342
+ pub fn Array(comptime MaskIntType: type, comptime size: usize) type {
335
343
  const mask_info: std.builtin.Type = @typeInfo(MaskIntType);
336
344
 
337
345
  // Make sure the mask int is indeed an int
338
- if (mask_info != .int) @compileError("ArrayBitSet can only operate on integer masks, but was passed " ++ @typeName(MaskIntType));
346
+ if (mask_info != .int) @compileError("Array can only operate on integer masks, but was passed " ++ @typeName(MaskIntType));
339
347
 
340
348
  // It must also be unsigned.
341
- if (mask_info.int.signedness != .unsigned) @compileError("ArrayBitSet requires an unsigned integer mask type, but was passed " ++ @typeName(MaskIntType));
349
+ if (mask_info.int.signedness != .unsigned) @compileError("Array requires an unsigned integer mask type, but was passed " ++ @typeName(MaskIntType));
342
350
 
343
351
  // And it must not be empty.
344
352
  if (MaskIntType == u0)
345
- @compileError("ArrayBitSet requires a sized integer for its mask int. u0 does not work.");
353
+ @compileError("Array requires a sized integer for its mask int. u0 does not work.");
346
354
 
347
355
  const byte_size = std.mem.byte_size_in_bits;
348
356
 
@@ -352,7 +360,7 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type {
352
360
  var desired_bits = std.math.ceilPowerOfTwoAssert(usize, @bitSizeOf(MaskIntType));
353
361
  if (desired_bits < byte_size) desired_bits = byte_size;
354
362
  const FixedMaskType = std.meta.Int(.unsigned, desired_bits);
355
- @compileError("ArrayBitSet was passed integer type " ++ @typeName(MaskIntType) ++
363
+ @compileError("Array was passed integer type " ++ @typeName(MaskIntType) ++
356
364
  ", which is not a power of two. Please round this up to a power of two integer size (i.e. " ++ @typeName(FixedMaskType) ++ ").");
357
365
  }
358
366
 
@@ -363,7 +371,7 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type {
363
371
  var desired_bits = @sizeOf(MaskIntType) * byte_size;
364
372
  desired_bits = std.math.ceilPowerOfTwoAssert(usize, desired_bits);
365
373
  const FixedMaskType = std.meta.Int(.unsigned, desired_bits);
366
- @compileError("ArrayBitSet was passed integer type " ++ @typeName(MaskIntType) ++
374
+ @compileError("Array was passed integer type " ++ @typeName(MaskIntType) ++
367
375
  ", which contains padding bits. Please round this up to an unpadded integer size (i.e. " ++ @typeName(FixedMaskType) ++ ").");
368
376
  }
369
377
 
@@ -673,7 +681,7 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type {
673
681
  }
674
682
 
675
683
  pub fn Iterator(comptime options: IteratorOptions) type {
676
- return BitSetIterator(MaskInt, options);
684
+ return GenericIterator(MaskInt, options);
677
685
  }
678
686
 
679
687
  fn maskBit(index: usize) MaskInt {
@@ -688,9 +696,12 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type {
688
696
  };
689
697
  }
690
698
 
699
+ /// Deprecated: use `Dynamic`.
700
+ pub const DynamicBitSetUnmanaged = Dynamic;
701
+
691
702
  /// A bit set with runtime-known size, backed by an allocated slice
692
703
  /// of usize. The allocator must be tracked externally by the user.
693
- pub const DynamicBitSetUnmanaged = struct {
704
+ pub const Dynamic = struct {
694
705
  const Self = @This();
695
706
 
696
707
  /// The integer type used to represent a mask in this bit set
@@ -1074,7 +1085,7 @@ pub const DynamicBitSetUnmanaged = struct {
1074
1085
  }
1075
1086
 
1076
1087
  pub fn Iterator(comptime options: IteratorOptions) type {
1077
- return BitSetIterator(MaskInt, options);
1088
+ return GenericIterator(MaskInt, options);
1078
1089
  }
1079
1090
 
1080
1091
  fn maskBit(index: usize) MaskInt {
@@ -1091,10 +1102,16 @@ pub const DynamicBitSetUnmanaged = struct {
1091
1102
  }
1092
1103
  };
1093
1104
 
1105
+ /// Deprecated: use `DynamicManaged` or `Dynamic` (will need to update callsites).
1106
+ pub const DynamicBitSet = DynamicManaged;
1107
+
1094
1108
  /// A bit set with runtime-known size, backed by an allocated slice
1095
- /// of usize. Thin wrapper around DynamicBitSetUnmanaged which keeps
1109
+ /// of usize. Thin wrapper around Dynamic which keeps
1096
1110
  /// track of the allocator instance.
1097
- pub const DynamicBitSet = struct {
1111
+ ///
1112
+ /// Deprecated in favor of `Dynamic` which accepts an `Allocator`
1113
+ /// as a parameter when needed instead of storing it.
1114
+ pub const DynamicManaged = struct {
1098
1115
  const Self = @This();
1099
1116
 
1100
1117
  /// The integer type used to represent a mask in this bit set
@@ -1104,12 +1121,12 @@ pub const DynamicBitSet = struct {
1104
1121
  pub const ShiftInt = std.math.Log2Int(MaskInt);
1105
1122
 
1106
1123
  allocator: Allocator,
1107
- unmanaged: DynamicBitSetUnmanaged = .{},
1124
+ unmanaged: Dynamic = .{},
1108
1125
 
1109
1126
  /// Creates a bit set with no elements present.
1110
1127
  pub fn initEmpty(allocator: Allocator, bit_length: usize) !Self {
1111
1128
  return Self{
1112
- .unmanaged = try DynamicBitSetUnmanaged.initEmpty(allocator, bit_length),
1129
+ .unmanaged = try .initEmpty(allocator, bit_length),
1113
1130
  .allocator = allocator,
1114
1131
  };
1115
1132
  }
@@ -1117,7 +1134,7 @@ pub const DynamicBitSet = struct {
1117
1134
  /// Creates a bit set with all elements present.
1118
1135
  pub fn initFull(allocator: Allocator, bit_length: usize) !Self {
1119
1136
  return Self{
1120
- .unmanaged = try DynamicBitSetUnmanaged.initFull(allocator, bit_length),
1137
+ .unmanaged = try .initFull(allocator, bit_length),
1121
1138
  .allocator = allocator,
1122
1139
  };
1123
1140
  }
@@ -1247,7 +1264,7 @@ pub const DynamicBitSet = struct {
1247
1264
  return self.unmanaged.iterator(options);
1248
1265
  }
1249
1266
 
1250
- pub const Iterator = DynamicBitSetUnmanaged.Iterator;
1267
+ pub const Iterator = Dynamic.Iterator;
1251
1268
  };
1252
1269
 
1253
1270
  /// Options for configuring an iterator over a bit set
@@ -1274,7 +1291,7 @@ pub const IteratorOptions = struct {
1274
1291
  };
1275
1292
 
1276
1293
  // The iterator is reusable between several bit set types
1277
- fn BitSetIterator(comptime MaskInt: type, comptime options: IteratorOptions) type {
1294
+ fn GenericIterator(comptime MaskInt: type, comptime options: IteratorOptions) type {
1278
1295
  const ShiftInt = std.math.Log2Int(MaskInt);
1279
1296
  const kind = options.kind;
1280
1297
  const direction = options.direction;
@@ -1713,37 +1730,37 @@ fn testStaticBitSet(comptime Set: type) !void {
1713
1730
  try testPureBitSet(Set);
1714
1731
  }
1715
1732
 
1716
- test IntegerBitSet {
1733
+ test Integer {
1717
1734
  if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1718
1735
  if (comptime builtin.cpu.has(.riscv, .v) and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/24300
1719
1736
 
1720
- try testStaticBitSet(IntegerBitSet(0));
1721
- try testStaticBitSet(IntegerBitSet(1));
1722
- try testStaticBitSet(IntegerBitSet(2));
1723
- try testStaticBitSet(IntegerBitSet(5));
1724
- try testStaticBitSet(IntegerBitSet(8));
1725
- try testStaticBitSet(IntegerBitSet(32));
1726
- try testStaticBitSet(IntegerBitSet(64));
1727
- try testStaticBitSet(IntegerBitSet(127));
1737
+ try testStaticBitSet(Integer(0));
1738
+ try testStaticBitSet(Integer(1));
1739
+ try testStaticBitSet(Integer(2));
1740
+ try testStaticBitSet(Integer(5));
1741
+ try testStaticBitSet(Integer(8));
1742
+ try testStaticBitSet(Integer(32));
1743
+ try testStaticBitSet(Integer(64));
1744
+ try testStaticBitSet(Integer(127));
1728
1745
  }
1729
1746
 
1730
- test ArrayBitSet {
1747
+ test Array {
1731
1748
  inline for (.{ 0, 1, 2, 31, 32, 33, 63, 64, 65, 254, 500, 3000 }) |size| {
1732
- try testStaticBitSet(ArrayBitSet(u8, size));
1733
- try testStaticBitSet(ArrayBitSet(u16, size));
1734
- try testStaticBitSet(ArrayBitSet(u32, size));
1735
- try testStaticBitSet(ArrayBitSet(u64, size));
1736
- try testStaticBitSet(ArrayBitSet(u128, size));
1749
+ try testStaticBitSet(Array(u8, size));
1750
+ try testStaticBitSet(Array(u16, size));
1751
+ try testStaticBitSet(Array(u32, size));
1752
+ try testStaticBitSet(Array(u64, size));
1753
+ try testStaticBitSet(Array(u128, size));
1737
1754
  }
1738
1755
  }
1739
1756
 
1740
- test DynamicBitSetUnmanaged {
1757
+ test Dynamic {
1741
1758
  const allocator = std.testing.allocator;
1742
- var a = try DynamicBitSetUnmanaged.initEmpty(allocator, 300);
1759
+ var a: Dynamic = try .initEmpty(allocator, 300);
1743
1760
  try testing.expectEqual(@as(usize, 0), a.count());
1744
1761
  a.deinit(allocator);
1745
1762
 
1746
- a = try DynamicBitSetUnmanaged.initEmpty(allocator, 0);
1763
+ a = try .initEmpty(allocator, 0);
1747
1764
  defer a.deinit(allocator);
1748
1765
  for ([_]usize{ 1, 2, 31, 32, 33, 0, 65, 64, 63, 500, 254, 3000 }) |size| {
1749
1766
  const old_len = a.capacity();
@@ -1769,17 +1786,17 @@ test DynamicBitSetUnmanaged {
1769
1786
  }
1770
1787
  try testing.expectEqual(@as(usize, 0), empty.count());
1771
1788
 
1772
- var full = try DynamicBitSetUnmanaged.initFull(allocator, size);
1789
+ var full: Dynamic = try .initFull(allocator, size);
1773
1790
  defer full.deinit(allocator);
1774
1791
  try testing.expectEqual(@as(usize, size), full.count());
1775
1792
 
1776
1793
  try testEql(empty, full, size);
1777
1794
  {
1778
- var even = try DynamicBitSetUnmanaged.initEmpty(allocator, size);
1795
+ var even: Dynamic = try .initEmpty(allocator, size);
1779
1796
  defer even.deinit(allocator);
1780
1797
  fillEven(&even, size);
1781
1798
 
1782
- var odd = try DynamicBitSetUnmanaged.initEmpty(allocator, size);
1799
+ var odd: Dynamic = try .initEmpty(allocator, size);
1783
1800
  defer odd.deinit(allocator);
1784
1801
  fillOdd(&odd, size);
1785
1802
 
@@ -1790,13 +1807,13 @@ test DynamicBitSetUnmanaged {
1790
1807
  }
1791
1808
  }
1792
1809
 
1793
- test DynamicBitSet {
1810
+ test DynamicManaged {
1794
1811
  const allocator = std.testing.allocator;
1795
- var a = try DynamicBitSet.initEmpty(allocator, 300);
1812
+ var a: DynamicManaged = try .initEmpty(allocator, 300);
1796
1813
  try testing.expectEqual(@as(usize, 0), a.count());
1797
1814
  a.deinit();
1798
1815
 
1799
- a = try DynamicBitSet.initEmpty(allocator, 0);
1816
+ a = try .initEmpty(allocator, 0);
1800
1817
  defer a.deinit();
1801
1818
  for ([_]usize{ 1, 2, 31, 32, 33, 0, 65, 64, 63, 500, 254, 3000 }) |size| {
1802
1819
  const old_len = a.capacity();
@@ -1822,7 +1839,7 @@ test DynamicBitSet {
1822
1839
  }
1823
1840
  try testing.expectEqual(@as(usize, 0), tmp.count());
1824
1841
 
1825
- var b = try DynamicBitSet.initFull(allocator, size);
1842
+ var b: DynamicManaged = try .initFull(allocator, size);
1826
1843
  defer b.deinit();
1827
1844
  try testing.expectEqual(@as(usize, size), b.count());
1828
1845
 
@@ -1831,10 +1848,10 @@ test DynamicBitSet {
1831
1848
  }
1832
1849
  }
1833
1850
 
1834
- test StaticBitSet {
1835
- try testing.expectEqual(IntegerBitSet(0), StaticBitSet(0));
1836
- try testing.expectEqual(IntegerBitSet(5), StaticBitSet(5));
1837
- try testing.expectEqual(IntegerBitSet(@bitSizeOf(usize)), StaticBitSet(@bitSizeOf(usize)));
1838
- try testing.expectEqual(ArrayBitSet(usize, @bitSizeOf(usize) + 1), StaticBitSet(@bitSizeOf(usize) + 1));
1839
- try testing.expectEqual(ArrayBitSet(usize, 500), StaticBitSet(500));
1851
+ test Static {
1852
+ try testing.expectEqual(Integer(0), Static(0));
1853
+ try testing.expectEqual(Integer(5), Static(5));
1854
+ try testing.expectEqual(Integer(@bitSizeOf(usize)), Static(@bitSizeOf(usize)));
1855
+ try testing.expectEqual(Array(usize, @bitSizeOf(usize) + 1), Static(@bitSizeOf(usize) + 1));
1856
+ try testing.expectEqual(Array(usize, 500), Static(500));
1840
1857
  }
package/std/c.zig CHANGED
@@ -1664,12 +1664,12 @@ pub const MSF = switch (native_os) {
1664
1664
  pub const ASYNC = 1;
1665
1665
  pub const INVALIDATE = 2;
1666
1666
  },
1667
- .openbsd => struct {
1667
+ .openbsd, .haiku => struct {
1668
1668
  pub const ASYNC = 1;
1669
1669
  pub const SYNC = 2;
1670
1670
  pub const INVALIDATE = 4;
1671
1671
  },
1672
- .haiku, .netbsd, .illumos => struct {
1672
+ .netbsd, .illumos => struct {
1673
1673
  pub const ASYNC = 1;
1674
1674
  pub const INVALIDATE = 2;
1675
1675
  pub const SYNC = 4;
@@ -3,7 +3,7 @@
3
3
  //! This is designed to be used in cryptographic applications where timing attacks are a concern.
4
4
  const std = @import("std");
5
5
  const testing = std.testing;
6
- const StaticBitSet = std.StaticBitSet;
6
+ const StaticBitSet = std.bit_set.Static;
7
7
 
8
8
  pub const Error = error{
9
9
  /// An invalid character was found in the input.
@@ -1456,8 +1456,6 @@ fn randPolyNormalized(rnd: anytype) Poly {
1456
1456
  }
1457
1457
 
1458
1458
  test "MulHat" {
1459
- if (comptime builtin.cpu.has(.s390x, .vector)) return error.SkipZigTest;
1460
-
1461
1459
  var rnd = RndGen.init(0);
1462
1460
 
1463
1461
  for (0..100) |_| {
@@ -1612,8 +1610,6 @@ test "Polynomial packing" {
1612
1610
  }
1613
1611
 
1614
1612
  test "Test inner PKE" {
1615
- if (comptime builtin.cpu.has(.s390x, .vector)) return error.SkipZigTest;
1616
-
1617
1613
  var seed: [32]u8 = undefined;
1618
1614
  var pt: [32]u8 = undefined;
1619
1615
  for (&seed, &pt, 0..) |*s, *p, i| {
@@ -1635,8 +1631,6 @@ test "Test inner PKE" {
1635
1631
  }
1636
1632
 
1637
1633
  test "Test happy flow" {
1638
- if (comptime builtin.cpu.has(.s390x, .vector)) return error.SkipZigTest;
1639
-
1640
1634
  var seed: [64]u8 = undefined;
1641
1635
  for (&seed, 0..) |*s, i| {
1642
1636
  s.* = @as(u8, @intCast(i));
@@ -1661,23 +1655,14 @@ test "Test happy flow" {
1661
1655
  // Code to test NIST Known Answer Tests (KAT), see PQCgenKAT.c.
1662
1656
 
1663
1657
  test "NIST KAT test d00.Kyber512" {
1664
- if (comptime builtin.cpu.has(.loongarch, .lsx)) return error.SkipZigTest;
1665
- if (comptime builtin.cpu.has(.s390x, .vector)) return error.SkipZigTest;
1666
-
1667
1658
  try testNistKat(d00.Kyber512, "e9c2bd37133fcb40772f81559f14b1f58dccd1c816701be9ba6214d43baf4547");
1668
1659
  }
1669
1660
 
1670
1661
  test "NIST KAT test d00.Kyber1024" {
1671
- if (comptime builtin.cpu.has(.loongarch, .lsx)) return error.SkipZigTest;
1672
- if (comptime builtin.cpu.has(.s390x, .vector)) return error.SkipZigTest;
1673
-
1674
1662
  try testNistKat(d00.Kyber1024, "89248f2f33f7f4f7051729111f3049c409a933ec904aedadf035f30fa5646cd5");
1675
1663
  }
1676
1664
 
1677
1665
  test "NIST KAT test d00.Kyber768" {
1678
- if (comptime builtin.cpu.has(.loongarch, .lsx)) return error.SkipZigTest;
1679
- if (comptime builtin.cpu.has(.s390x, .vector)) return error.SkipZigTest;
1680
-
1681
1666
  try testNistKat(d00.Kyber768, "a1e122cad3c24bc51622e4c242d8b8acbcd3f618fee4220400605ca8f9ea02c2");
1682
1667
  }
1683
1668
 
package/std/enums.zig CHANGED
@@ -247,7 +247,7 @@ pub fn EnumSet(comptime E: type) type {
247
247
  /// The element type for this set.
248
248
  pub const Key = Indexer.Key;
249
249
 
250
- const BitSet = std.StaticBitSet(Indexer.count);
250
+ const BitSet = std.bit_set.Static(Indexer.count);
251
251
 
252
252
  /// The maximum number of items in this set.
253
253
  pub const len = Indexer.count;
@@ -445,7 +445,7 @@ pub fn EnumMap(comptime E: type, comptime V: type) type {
445
445
  /// The number of possible keys in the map
446
446
  pub const len = Indexer.count;
447
447
 
448
- const BitSet = std.StaticBitSet(Indexer.count);
448
+ const BitSet = std.bit_set.Static(Indexer.count);
449
449
 
450
450
  /// Bits determining whether items are in the map
451
451
  bits: BitSet = .empty,
package/std/fs/path.zig CHANGED
@@ -897,7 +897,7 @@ pub fn resolveWindows(allocator: Allocator, paths: []const []const u8) Allocator
897
897
  var buf: [3]usize = undefined;
898
898
  var bit_set_allocator_state: std.heap.BufferFirstAllocator = .init(@ptrCast(&buf), allocator);
899
899
  const bit_set_allocator = bit_set_allocator_state.allocator();
900
- var relevant_paths = try std.bit_set.DynamicBitSetUnmanaged.initEmpty(bit_set_allocator, paths.len);
900
+ var relevant_paths: std.bit_set.Dynamic = try .initEmpty(bit_set_allocator, paths.len);
901
901
  defer relevant_paths.deinit(bit_set_allocator);
902
902
 
903
903
  // Iterate the paths backwards, marking the relevant paths along the way.
@@ -4,6 +4,68 @@ const assert = std.debug.assert;
4
4
  const expect = std.testing.expect;
5
5
  const expectEqual = std.testing.expectEqual;
6
6
 
7
+ /// A namespace for functions that deal with floats that provide greater than
8
+ /// double precision (`f80`, `f128`, `c_longdouble`). Commonly referred to as
9
+ /// `long double` in C.
10
+ pub const long_double = struct {
11
+ const U80 = @Int(.unsigned, 80);
12
+
13
+ inline fn bitWidth(x: anytype) u16 {
14
+ const T = @TypeOf(x);
15
+ return switch (T) {
16
+ f80, f128, c_longdouble => @typeInfo(T).float.bits,
17
+ else => @compileError("Unsupported type: " ++ @typeName(T) ++ "\nPass a `f80`, `f128`, or `c_longdouble`."),
18
+ };
19
+ }
20
+
21
+ /// Returns the sign + exponent bits of a `long double`.
22
+ pub fn signExponent(x: anytype) u16 {
23
+ const bit_width = bitWidth(x);
24
+ switch (bit_width) {
25
+ 80 => {
26
+ const bits: U80 = @bitCast(x);
27
+ return @intCast(bits >> 64);
28
+ },
29
+ 128 => {
30
+ const bits: u128 = @bitCast(x);
31
+ return @intCast(bits >> 112);
32
+ },
33
+ // `c_longdouble` can have <80 bits on some targets, we want to error on that
34
+ else => @compileError(std.fmt.comptimePrint("`signExponent` supports floats of only `80` and `128` bit width, got bit width: {d}", .{bit_width})),
35
+ }
36
+ }
37
+
38
+ test "signExponent" {
39
+ try expectEqual(signExponent(@as(f80, -0.0)), 0x8000);
40
+ try expectEqual(signExponent(@as(f128, 0.0)), 0x0000);
41
+ try expectEqual(signExponent(@as(f128, 42.0)), 0x4004);
42
+ try expectEqual(signExponent(nan(c_longdouble)), 0x7FFF);
43
+ }
44
+
45
+ /// Takes the top 16 bits of a `long double`'s mantissa.
46
+ pub fn mantissaTop(x: anytype) u16 {
47
+ const bit_width = bitWidth(x);
48
+ switch (bit_width) {
49
+ 80 => {
50
+ const bits: U80 = @bitCast(x);
51
+ return @intCast((bits >> 48) & 0xFFFF);
52
+ },
53
+ 128 => {
54
+ const bits: u128 = @bitCast(x);
55
+ return @intCast((bits >> 96) & 0xFFFF);
56
+ },
57
+ // `c_longdouble` can have <80 bits on some targets, we want to error on that
58
+ else => @compileError(std.fmt.comptimePrint("`mantissaTop` supports floats of only `80` and `128` bit width, got bit width: {d}", .{bit_width})),
59
+ }
60
+ }
61
+
62
+ test "mantissaTop" {
63
+ try expectEqual(mantissaTop(@as(f80, -0.0)), 0x0000);
64
+ try expectEqual(mantissaTop(nan(f128)), 0x8000);
65
+ try expectEqual(mantissaTop(@as(f128, 42.0)), 0x5000);
66
+ }
67
+ };
68
+
7
69
  pub fn FloatRepr(comptime Float: type) type {
8
70
  const fractional_bits = floatFractionalBits(Float);
9
71
  const exponent_bits = floatExponentBits(Float);
package/std/math/modf.zig CHANGED
@@ -86,7 +86,7 @@ fn ModfTests(comptime T: type) type {
86
86
  }
87
87
  test "vector" {
88
88
  if (builtin.os.tag.isDarwin() and builtin.cpu.arch == .aarch64) return error.SkipZigTest;
89
- if (builtin.cpu.arch == .s390x) return error.SkipZigTest;
89
+ if (builtin.cpu.arch == .s390x) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194256
90
90
 
91
91
  const widths = [_]comptime_int{ 1, 2, 3, 4, 8, 16 };
92
92
 
package/std/math.zig CHANGED
@@ -58,6 +58,7 @@ pub const floatMax = float.floatMax;
58
58
  pub const floatEps = float.floatEps;
59
59
  pub const floatEpsAt = float.floatEpsAt;
60
60
  pub const inf = float.inf;
61
+ pub const long_double = float.long_double;
61
62
  pub const nan = float.nan;
62
63
  pub const snan = float.snan;
63
64
 
package/std/std.zig CHANGED
@@ -9,7 +9,9 @@ pub const StaticStringMapWithEql = static_string_map.StaticStringMapWithEql;
9
9
  pub const Deque = @import("deque.zig").Deque;
10
10
  pub const DoublyLinkedList = @import("DoublyLinkedList.zig");
11
11
  pub const DynLib = @import("dynamic_library.zig").DynLib;
12
+ /// Deprecated: use `bit_set.DynamicManaged`.
12
13
  pub const DynamicBitSet = bit_set.DynamicBitSet;
14
+ /// Deprecated: use `bit_set.Dynamic`.
13
15
  pub const DynamicBitSetUnmanaged = bit_set.DynamicBitSetUnmanaged;
14
16
  pub const EnumArray = enums.EnumArray;
15
17
  pub const EnumMap = enums.EnumMap;
@@ -24,6 +26,7 @@ pub const Progress = @import("Progress.zig");
24
26
  pub const Random = @import("Random.zig");
25
27
  pub const SemanticVersion = @import("SemanticVersion.zig");
26
28
  pub const SinglyLinkedList = @import("SinglyLinkedList.zig");
29
+ /// Deprecated: use `bit_set.Static`.
27
30
  pub const StaticBitSet = bit_set.StaticBitSet;
28
31
  pub const StringHashMap = hash_map.StringHashMap;
29
32
  pub const StringHashMapUnmanaged = hash_map.StringHashMapUnmanaged;
package/std/testing.zig CHANGED
@@ -501,7 +501,7 @@ const BytesDiffer = struct {
501
501
  var row: usize = 0;
502
502
  while (expected_iterator.next()) |chunk| {
503
503
  // to avoid having to calculate diffs twice per chunk
504
- var diffs: std.bit_set.IntegerBitSet(16) = .{ .mask = 0 };
504
+ var diffs: std.bit_set.Integer(16) = .{ .mask = 0 };
505
505
  for (chunk, 0..) |byte, col| {
506
506
  const absolute_byte_index = col + row * 16;
507
507
  const diff = if (absolute_byte_index < self.actual.len) self.actual[absolute_byte_index] != byte else true;
@@ -84,7 +84,6 @@ pub const available_libcs = [_]ArchOsAbi{
84
84
  .{ .arch = .powerpc, .os = .netbsd, .abi = .eabihf, .os_ver = .{ .major = 1, .minor = 4, .patch = 0 } },
85
85
  .{ .arch = .powerpc, .os = .openbsd, .abi = .eabihf, .os_ver = .{ .major = 2, .minor = 8, .patch = 0 } },
86
86
  .{ .arch = .powerpc64, .os = .freebsd, .abi = .none, .os_ver = .{ .major = 8, .minor = 0, .patch = 0 } },
87
- .{ .arch = .powerpc64, .os = .linux, .abi = .gnu, .os_ver = .{ .major = 2, .minor = 6, .patch = 0 } },
88
87
  .{ .arch = .powerpc64, .os = .linux, .abi = .musl, .os_ver = .{ .major = 2, .minor = 6, .patch = 0 } },
89
88
  .{ .arch = .powerpc64, .os = .openbsd, .abi = .none, .os_ver = .{ .major = 6, .minor = 8, .patch = 0 } },
90
89
  .{ .arch = .powerpc64le, .os = .freebsd, .abi = .none, .os_ver = .{ .major = 13, .minor = 0, .patch = 0 } },
@@ -245,7 +244,7 @@ pub fn glibcArchNameHeaders(arch: std.Target.Cpu.Arch) [:0]const u8 {
245
244
  .arm, .armeb => "arm",
246
245
  .loongarch64 => "loongarch",
247
246
  .mips, .mipsel, .mips64, .mips64el => "mips",
248
- .powerpc, .powerpc64, .powerpc64le => "powerpc",
247
+ .powerpc, .powerpc64le => "powerpc",
249
248
  .riscv32, .riscv64 => "riscv",
250
249
  .sparc, .sparc64 => "sparc",
251
250
  .x86, .x86_64 => "x86",
package/std/zon/parse.zig CHANGED
@@ -3129,7 +3129,7 @@ test "std.zon free on error" {
3129
3129
 
3130
3130
  test "std.zon vector" {
3131
3131
  if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/15330
3132
- if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .s390x) return error.SkipZigTest; // github.com/ziglang/zig/issues/25957
3132
+ if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .s390x) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/25957
3133
3133
 
3134
3134
  const gpa = std.testing.allocator;
3135
3135
 
@@ -1,37 +0,0 @@
1
- //! Utilities for dealing with the `long double` type (`f80` or `f128`)
2
-
3
- const std = @import("std");
4
-
5
- pub const U80 = std.meta.Int(.unsigned, 80);
6
-
7
- /// Returns the sign + exponent bits of a `long double`
8
- pub fn signExponent(x: anytype) u16 {
9
- const T = @TypeOf(x);
10
- switch (T) {
11
- f80 => {
12
- const bits: U80 = @bitCast(x);
13
- return @intCast(bits >> 64);
14
- },
15
- f128 => {
16
- const bits: u128 = @bitCast(x);
17
- return @intCast(bits >> 112);
18
- },
19
- else => @compileError("`signExponent` supports only `f80` and `f128`, got: " ++ @typeName(T)),
20
- }
21
- }
22
-
23
- /// Takes the top 16 bits of a `long double`'s mantissa
24
- pub fn mantissaTop(x: anytype) u16 {
25
- const T = @TypeOf(x);
26
- switch (T) {
27
- f80 => {
28
- const bits: U80 = @bitCast(x);
29
- return @intCast((bits >> 48) & 0xFFFF);
30
- },
31
- f128 => {
32
- const bits: u128 = @bitCast(x);
33
- return @intCast((bits >> 96) & 0xFFFF);
34
- },
35
- else => @compileError("`mantissaTop` supports only `f80` and `f128`, got: " ++ @typeName(T)),
36
- }
37
- }
@@ -1,18 +0,0 @@
1
- /**
2
- * This file has no copyright assigned and is placed in the Public Domain.
3
- * This file is part of the mingw-w64 runtime package.
4
- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5
- */
6
- #include <math.h>
7
-
8
- long lrintl (long double x)
9
- {
10
- long retval = 0l;
11
- #if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
12
- retval = lrint(x);
13
- #elif defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__)
14
- __asm__ __volatile__ ("fistpl %0" : "=m" (retval) : "t" (x) : "st");
15
- #endif
16
- return retval;
17
- }
18
-
@@ -1,16 +0,0 @@
1
- /**
2
- * This file has no copyright assigned and is placed in the Public Domain.
3
- * This file is part of the mingw-w64 runtime package.
4
- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5
- */
6
- #include <math.h>
7
-
8
- long double rintl (long double x) {
9
- long double retval = 0.0L;
10
- #if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
11
- retval = rint(x);
12
- #elif defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__)
13
- __asm__ __volatile__ ("frndint;": "=t" (retval) : "0" (x));
14
- #endif
15
- return retval;
16
- }
@@ -1,8 +0,0 @@
1
- #include <math.h>
2
-
3
- long lrintl(long double x)
4
- {
5
- long r;
6
- __asm__ ("fistpl %0" : "=m"(r) : "t"(x) : "st");
7
- return r;
8
- }