@zigc/lib 0.17.0-dev.269 → 0.17.0-dev.292

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 (89) hide show
  1. package/compiler/aro/aro/CodeGen.zig +2 -2
  2. package/compiler/resinator/errors.zig +7 -7
  3. package/compiler_rt/addf3.zig +1 -1
  4. package/compiler_rt/comparef.zig +3 -3
  5. package/compiler_rt/count0bits.zig +1 -1
  6. package/compiler_rt/divdf3.zig +2 -2
  7. package/compiler_rt/divsf3.zig +1 -1
  8. package/compiler_rt/divtf3.zig +1 -1
  9. package/compiler_rt/divxf3.zig +1 -1
  10. package/compiler_rt/extendf.zig +5 -5
  11. package/compiler_rt/fabs.zig +1 -1
  12. package/compiler_rt/float_from_int.zig +3 -4
  13. package/compiler_rt/fmax.zig +1 -1
  14. package/compiler_rt/fmin.zig +1 -1
  15. package/compiler_rt/fmod.zig +2 -2
  16. package/compiler_rt/mulf3.zig +2 -2
  17. package/compiler_rt/truncf.zig +3 -3
  18. package/compiler_rt.zig +4 -4
  19. package/package.json +1 -1
  20. package/std/Build/Watch/FsEvents.zig +1 -1
  21. package/std/Build/abi.zig +1 -1
  22. package/std/Io/Dir.zig +2 -2
  23. package/std/Io/Dispatch.zig +2 -2
  24. package/std/Io/Threaded.zig +5 -5
  25. package/std/Io/Uring.zig +2 -2
  26. package/std/Io/Writer.zig +2 -2
  27. package/std/Random.zig +6 -6
  28. package/std/Target.zig +1 -1
  29. package/std/bit_set.zig +3 -3
  30. package/std/c.zig +7 -6
  31. package/std/compress/zstd/Decompress.zig +5 -5
  32. package/std/crypto/aes_ccm.zig +2 -2
  33. package/std/crypto/cmac.zig +1 -1
  34. package/std/crypto/codecs/asn1/der/Encoder.zig +1 -1
  35. package/std/crypto/ff.zig +2 -3
  36. package/std/crypto/keccak_p.zig +1 -1
  37. package/std/crypto/ml_dsa.zig +6 -6
  38. package/std/crypto/ml_kem.zig +6 -6
  39. package/std/crypto/modes.zig +1 -1
  40. package/std/crypto/pcurves/common.zig +4 -5
  41. package/std/crypto/timing_safe.zig +5 -5
  42. package/std/debug.zig +4 -1
  43. package/std/enums.zig +5 -5
  44. package/std/fmt/parse_float.zig +1 -1
  45. package/std/fmt.zig +1 -6
  46. package/std/hash/wyhash.zig +1 -1
  47. package/std/hash_map.zig +20 -1
  48. package/std/heap/debug_allocator.zig +1 -1
  49. package/std/{builtin.zig → lang.zig} +1 -1
  50. package/std/leb128.zig +2 -2
  51. package/std/math/big/int.zig +2 -2
  52. package/std/math/big.zig +4 -4
  53. package/std/math/copysign.zig +1 -1
  54. package/std/math/frexp.zig +4 -4
  55. package/std/math/ilogb.zig +1 -1
  56. package/std/math/isfinite.zig +1 -1
  57. package/std/math/isinf.zig +1 -1
  58. package/std/math/isnan.zig +1 -2
  59. package/std/math/isnormal.zig +2 -2
  60. package/std/math/iszero.zig +2 -2
  61. package/std/math/ldexp.zig +2 -2
  62. package/std/math/nextafter.zig +2 -2
  63. package/std/math/pow.zig +1 -1
  64. package/std/math.zig +8 -8
  65. package/std/mem/Allocator.zig +0 -6
  66. package/std/mem.zig +21 -21
  67. package/std/meta/trailer_flags.zig +1 -1
  68. package/std/meta.zig +3 -35
  69. package/std/os/emscripten.zig +4 -4
  70. package/std/os/linux/bpf.zig +6 -0
  71. package/std/os/linux/ioctl.zig +2 -2
  72. package/std/os/linux.zig +14 -12
  73. package/std/os/plan9.zig +1 -1
  74. package/std/os/uefi/tables/runtime_services.zig +1 -1
  75. package/std/posix.zig +1 -1
  76. package/std/process/Environ.zig +1 -1
  77. package/std/process.zig +2 -2
  78. package/std/std.zig +4 -1
  79. package/std/testing.zig +1 -1
  80. package/std/zig/Ast.zig +2 -2
  81. package/std/zig/AstGen.zig +37 -37
  82. package/std/zig/LibCInstallation.zig +3 -3
  83. package/std/zig/Zir.zig +15 -15
  84. package/std/zig/llvm/Builder.zig +16 -6
  85. package/std/zig/llvm/bitcode_writer.zig +3 -3
  86. package/std/zig/llvm/ir.zig +8 -8
  87. package/std/zig/target.zig +1 -3
  88. package/std/zig.zig +2 -2
  89. /package/std/{builtin → lang}/assembly.zig +0 -0
@@ -533,7 +533,7 @@ pub const Frame = struct {
533
533
  table: Table,
534
534
  accuracy_log: u8,
535
535
 
536
- const State = std.meta.Int(.unsigned, max_accuracy_log);
536
+ const State = @Int(.unsigned, max_accuracy_log);
537
537
  };
538
538
  }
539
539
 
@@ -1783,7 +1783,7 @@ const ReverseBitReader = struct {
1783
1783
  }
1784
1784
 
1785
1785
  fn initBits(comptime T: type, out: anytype, num: u16) Bits(T) {
1786
- const UT = std.meta.Int(.unsigned, @bitSizeOf(T));
1786
+ const UT = @Int(.unsigned, @bitSizeOf(T));
1787
1787
  return .{
1788
1788
  @bitCast(@as(UT, @intCast(out))),
1789
1789
  num,
@@ -1803,7 +1803,7 @@ const ReverseBitReader = struct {
1803
1803
  }
1804
1804
 
1805
1805
  fn readBitsTuple(self: *ReverseBitReader, comptime T: type, num: u16) !Bits(T) {
1806
- const UT = std.meta.Int(.unsigned, @bitSizeOf(T));
1806
+ const UT = @Int(.unsigned, @bitSizeOf(T));
1807
1807
  const U = if (@bitSizeOf(T) < 8) u8 else UT;
1808
1808
 
1809
1809
  if (num <= self.count) return initBits(T, self.removeBits(@intCast(num)), num);
@@ -1871,7 +1871,7 @@ const BitReader = struct {
1871
1871
  count: u4 = 0,
1872
1872
 
1873
1873
  fn initBits(comptime T: type, out: anytype, num: u16) Bits(T) {
1874
- const UT = std.meta.Int(.unsigned, @bitSizeOf(T));
1874
+ const UT = @Int(.unsigned, @bitSizeOf(T));
1875
1875
  return .{
1876
1876
  @bitCast(@as(UT, @intCast(out))),
1877
1877
  num,
@@ -1891,7 +1891,7 @@ const BitReader = struct {
1891
1891
  }
1892
1892
 
1893
1893
  fn readBitsTuple(self: *@This(), comptime T: type, num: u16) !Bits(T) {
1894
- const UT = std.meta.Int(.unsigned, @bitSizeOf(T));
1894
+ const UT = @Int(.unsigned, @bitSizeOf(T));
1895
1895
  const U = if (@bitSizeOf(T) < 8) u8 else UT;
1896
1896
 
1897
1897
  if (num <= self.count) return initBits(T, self.removeBits(@intCast(num)), num);
@@ -171,7 +171,7 @@ fn AesCcm(comptime BlockCipher: type, comptime tag_len: usize, comptime nonce_le
171
171
  block[0] = L - 1; // flags
172
172
  @memcpy(block[1..][0..nonce_length], &npub);
173
173
  // Counter goes in the last L bytes
174
- const CounterInt = std.meta.Int(.unsigned, L * 8);
174
+ const CounterInt = @Int(.unsigned, L * 8);
175
175
  mem.writeInt(CounterInt, block[1 + nonce_length ..][0..L], @as(CounterInt, @intCast(counter)), .big);
176
176
  }
177
177
 
@@ -229,7 +229,7 @@ fn AesCcm(comptime BlockCipher: type, comptime tag_len: usize, comptime nonce_le
229
229
  @memcpy(block[1..][0..nonce_length], &npub);
230
230
 
231
231
  // Encode message length in last L bytes
232
- const LengthInt = std.meta.Int(.unsigned, L * 8);
232
+ const LengthInt = @Int(.unsigned, L * 8);
233
233
  mem.writeInt(LengthInt, block[1 + nonce_length ..][0..L], @as(LengthInt, @intCast(msg_len)), .big);
234
234
  }
235
235
 
@@ -74,7 +74,7 @@ pub fn Cmac(comptime BlockCipher: type) type {
74
74
  }
75
75
 
76
76
  fn double(l: Block) Block {
77
- const Int = std.meta.Int(.unsigned, block_length * 8);
77
+ const Int = @Int(.unsigned, block_length * 8);
78
78
  const l_ = mem.readInt(Int, &l, .big);
79
79
  const l_2 = switch (block_length) {
80
80
  8 => (l_ << 1) ^ (0x1b & -%(l_ >> 63)), // mod x^64 + x^4 + x^3 + x + 1
@@ -129,7 +129,7 @@ fn int(self: *Encoder, comptime T: type, value: T) !void {
129
129
  const needs_padding: u1 = if (value == 0)
130
130
  1
131
131
  else if (bits_needed > 8) brk: {
132
- const RightShift = std.meta.Int(.unsigned, @bitSizeOf(@TypeOf(bits_needed)) - 1);
132
+ const RightShift = @Int(.unsigned, @bitSizeOf(@TypeOf(bits_needed)) - 1);
133
133
  const right_shift: RightShift = @intCast(bits_needed - 9);
134
134
  break :brk if (value >> right_shift == 0x1ff) 1 else 0;
135
135
  } else 0;
package/std/crypto/ff.zig CHANGED
@@ -10,7 +10,6 @@ const builtin = @import("builtin");
10
10
  const crypto = std.crypto;
11
11
  const math = std.math;
12
12
  const mem = std.mem;
13
- const meta = std.meta;
14
13
  const testing = std.testing;
15
14
  const assert = std.debug.assert;
16
15
  const Endian = std.builtin.Endian;
@@ -25,7 +24,7 @@ const carry_bits = 1;
25
24
  const t_bits: usize = @bitSizeOf(Limb) - carry_bits;
26
25
 
27
26
  // A TLimb is a Limb that is truncated to t_bits.
28
- const TLimb = meta.Int(.unsigned, t_bits);
27
+ const TLimb = @Int(.unsigned, t_bits);
29
28
 
30
29
  const native_endian = builtin.target.cpu.arch.endian();
31
30
 
@@ -906,7 +905,7 @@ const ct_protected = struct {
906
905
  // Multiplies two limbs and returns the result as a wide limb.
907
906
  fn mulWide(x: Limb, y: Limb) WideLimb {
908
907
  const half_bits = @typeInfo(Limb).int.bits / 2;
909
- const Half = meta.Int(.unsigned, half_bits);
908
+ const Half = @Int(.unsigned, half_bits);
910
909
  const x0 = @as(Half, @truncate(x));
911
910
  const x1 = @as(Half, @truncate(x >> half_bits));
912
911
  const y0 = @as(Half, @truncate(y));
@@ -9,7 +9,7 @@ const mode = @import("builtin").mode;
9
9
  /// The Keccak-f permutation.
10
10
  pub fn KeccakF(comptime f: u11) type {
11
11
  comptime assert(f >= 200 and f <= 1600 and f % 200 == 0); // invalid bit size
12
- const T = std.meta.Int(.unsigned, f / 25);
12
+ const T = @Int(.unsigned, f / 25);
13
13
  const Block = [25]T;
14
14
 
15
15
  const PI = [_]u5{
@@ -3413,7 +3413,7 @@ fn modularInverse(comptime T: type, comptime a: T, comptime p: T) T {
3413
3413
  // Use a signed type for EEA computation
3414
3414
  const type_info = @typeInfo(T);
3415
3415
  const SignedT = if (type_info == .int and type_info.int.signedness == .unsigned)
3416
- std.meta.Int(.signed, type_info.int.bits)
3416
+ @Int(.signed, type_info.int.bits)
3417
3417
  else
3418
3418
  T;
3419
3419
 
@@ -3436,7 +3436,7 @@ fn modularInverse(comptime T: type, comptime a: T, comptime p: T) T {
3436
3436
  fn modularPow(comptime T: type, comptime a: T, s: T, comptime p: T) T {
3437
3437
  const type_info = @typeInfo(T);
3438
3438
  const bits = type_info.int.bits;
3439
- const WideT = std.meta.Int(.unsigned, bits * 2);
3439
+ const WideT = @Int(.unsigned, bits * 2);
3440
3440
 
3441
3441
  var ret: T = 1;
3442
3442
  var base: T = a;
@@ -3465,14 +3465,14 @@ fn bitMask(comptime T: type, bit: T) T {
3465
3465
 
3466
3466
  /// Creates a mask from the sign bit of a signed integer.
3467
3467
  /// Returns all 1s (0xFF...FF) if x < 0, all 0s if x >= 0.
3468
- fn signMask(comptime T: type, x: T) std.meta.Int(.unsigned, @typeInfo(T).int.bits) {
3468
+ fn signMask(comptime T: type, x: T) @Int(.unsigned, @typeInfo(T).int.bits) {
3469
3469
  const type_info = @typeInfo(T);
3470
3470
  if (type_info != .int) {
3471
3471
  @compileError("signMask requires an integer type");
3472
3472
  }
3473
3473
 
3474
3474
  const bits = type_info.int.bits;
3475
- const SignedT = std.meta.Int(.signed, bits);
3475
+ const SignedT = @Int(.signed, bits);
3476
3476
 
3477
3477
  // Convert to signed if needed, arithmetic right shift to propagate sign bit
3478
3478
  const x_signed: SignedT = if (type_info.int.signedness == .signed) x else @bitCast(x);
@@ -3499,8 +3499,8 @@ fn montgomeryReduce(
3499
3499
  const m: OutT = @truncate(m_full);
3500
3500
 
3501
3501
  const yR = x -% @as(InT, m) * @as(InT, q);
3502
- const y_shifted = @as(std.meta.Int(.unsigned, @typeInfo(InT).Int.bits), @bitCast(yR)) >> r_bits;
3503
- return @bitCast(@as(std.meta.Int(.unsigned, @typeInfo(OutT).Int.bits), @truncate(y_shifted)));
3502
+ const y_shifted = @as(@Int(.unsigned, @typeInfo(InT).Int.bits), @bitCast(yR)) >> r_bits;
3503
+ return @bitCast(@as(@Int(.unsigned, @typeInfo(OutT).Int.bits), @truncate(y_shifted)));
3504
3504
  }
3505
3505
 
3506
3506
  /// Uniform sampling using SHAKE-128 with rejection sampling.
@@ -1794,7 +1794,7 @@ fn modularInverse(comptime T: type, comptime a: T, comptime p: T) T {
1794
1794
  // Use a signed type for EEA computation
1795
1795
  const type_info = @typeInfo(T);
1796
1796
  const SignedT = if (type_info == .int and type_info.int.signedness == .unsigned)
1797
- std.meta.Int(.signed, type_info.int.bits)
1797
+ @Int(.signed, type_info.int.bits)
1798
1798
  else
1799
1799
  T;
1800
1800
 
@@ -1817,7 +1817,7 @@ fn modularInverse(comptime T: type, comptime a: T, comptime p: T) T {
1817
1817
  fn modularPow(comptime T: type, comptime a: T, s: T, comptime p: T) T {
1818
1818
  const type_info = @typeInfo(T);
1819
1819
  const bits = type_info.int.bits;
1820
- const WideT = std.meta.Int(.unsigned, bits * 2);
1820
+ const WideT = @Int(.unsigned, bits * 2);
1821
1821
 
1822
1822
  var ret: T = 1;
1823
1823
  var base: T = a;
@@ -1846,14 +1846,14 @@ fn bitMask(comptime T: type, bit: T) T {
1846
1846
 
1847
1847
  /// Creates a mask from the sign bit of a signed integer.
1848
1848
  /// Returns all 1s (0xFF...FF) if x < 0, all 0s if x >= 0.
1849
- fn signMask(comptime T: type, x: T) std.meta.Int(.unsigned, @typeInfo(T).int.bits) {
1849
+ fn signMask(comptime T: type, x: T) @Int(.unsigned, @typeInfo(T).int.bits) {
1850
1850
  const type_info = @typeInfo(T);
1851
1851
  if (type_info != .int) {
1852
1852
  @compileError("signMask requires an integer type");
1853
1853
  }
1854
1854
 
1855
1855
  const bits = type_info.int.bits;
1856
- const SignedT = std.meta.Int(.signed, bits);
1856
+ const SignedT = @Int(.signed, bits);
1857
1857
 
1858
1858
  // Convert to signed if needed, arithmetic right shift to propagate sign bit
1859
1859
  const x_signed: SignedT = if (type_info.int.signedness == .signed) x else @bitCast(x);
@@ -1898,8 +1898,8 @@ fn montgomeryReduce(
1898
1898
  const m: OutT = @truncate(m_full);
1899
1899
 
1900
1900
  const yR = x -% @as(InT, m) * @as(InT, q);
1901
- const y_shifted = @as(std.meta.Int(.unsigned, @typeInfo(InT).Int.bits), @bitCast(yR)) >> r_bits;
1902
- return @bitCast(@as(std.meta.Int(.unsigned, @typeInfo(OutT).Int.bits), @truncate(y_shifted)));
1901
+ const y_shifted = @as(@Int(.unsigned, @typeInfo(InT).Int.bits), @bitCast(yR)) >> r_bits;
1902
+ return @bitCast(@as(@Int(.unsigned, @typeInfo(OutT).Int.bits), @truncate(y_shifted)));
1903
1903
  }
1904
1904
 
1905
1905
  /// Uniform sampling using SHAKE-128 with rejection sampling.
@@ -40,7 +40,7 @@ pub fn ctrSlice(
40
40
  var counterBlock = iv;
41
41
  var i: usize = 0;
42
42
 
43
- const CounterInt = std.meta.Int(.unsigned, counter_size * 8);
43
+ const CounterInt = @Int(.unsigned, counter_size * 8);
44
44
 
45
45
  const parallel_count = BlockCipher.block.parallel.optimal_parallel_blocks;
46
46
  const wide_block_length = parallel_count * block_length;
@@ -2,7 +2,6 @@ const std = @import("std");
2
2
  const crypto = std.crypto;
3
3
  const debug = std.debug;
4
4
  const mem = std.mem;
5
- const meta = std.meta;
6
5
 
7
6
  const NonCanonicalError = crypto.errors.NonCanonicalError;
8
7
  const NotSquareError = crypto.errors.NotSquareError;
@@ -54,7 +53,7 @@ pub fn Field(comptime params: FieldParams) type {
54
53
  var s = if (endian == .little) s_ else orderSwap(s_);
55
54
  const field_order_s = comptime fos: {
56
55
  var fos: [encoded_length]u8 = undefined;
57
- mem.writeInt(std.meta.Int(.unsigned, encoded_length * 8), &fos, field_order, .little);
56
+ mem.writeInt(@Int(.unsigned, encoded_length * 8), &fos, field_order, .little);
58
57
  break :fos fos;
59
58
  };
60
59
  if (crypto.timing_safe.compare(u8, &s, &field_order_s, .little) != .lt) {
@@ -90,7 +89,7 @@ pub fn Field(comptime params: FieldParams) type {
90
89
  }
91
90
 
92
91
  /// Element as an integer.
93
- pub const IntRepr = meta.Int(.unsigned, params.field_bits);
92
+ pub const IntRepr = @Int(.unsigned, params.field_bits);
94
93
 
95
94
  /// Create a field element from an integer.
96
95
  pub fn fromInt(comptime x: IntRepr) NonCanonicalError!Fe {
@@ -270,7 +269,7 @@ pub fn Field(comptime params: FieldParams) type {
270
269
  const ls = x126.sqn(126).mul(x126).sqn(3).mul(t111).sqn(33).mul(x32).sqn(95).mul(x31);
271
270
  return ls.equivalent(Fe.one);
272
271
  } else {
273
- const ls = x2.pow(std.meta.Int(.unsigned, field_bits), (field_order - 1) / 2); // Legendre symbol
272
+ const ls = x2.pow(@Int(.unsigned, field_bits), (field_order - 1) / 2); // Legendre symbol
274
273
  return ls.equivalent(Fe.one);
275
274
  }
276
275
  }
@@ -307,7 +306,7 @@ pub fn Field(comptime params: FieldParams) type {
307
306
  const x108 = x54.sqn(54).mul(x54);
308
307
  return x108.sqn(108).mul(x108).sqn(7).mul(t1111111).sqn(23).mul(x22).sqn(6).mul(t11).sqn(2);
309
308
  } else {
310
- return x2.pow(std.meta.Int(.unsigned, field_bits), (field_order + 1) / 4);
309
+ return x2.pow(@Int(.unsigned, field_bits), (field_order + 1) / 4);
311
310
  }
312
311
  }
313
312
 
@@ -21,8 +21,8 @@ pub fn eql(comptime T: type, a: T, b: T) bool {
21
21
  acc |= x ^ b[i];
22
22
  }
23
23
  const s = @typeInfo(C).int.bits;
24
- const Cu = std.meta.Int(.unsigned, s);
25
- const Cext = std.meta.Int(.unsigned, s + 1);
24
+ const Cu = @Int(.unsigned, s);
25
+ const Cext = @Int(.unsigned, s + 1);
26
26
  return @as(bool, @bitCast(@as(u1, @truncate((@as(Cext, @as(Cu, @bitCast(acc))) -% 1) >> s))));
27
27
  },
28
28
  .vector => |info| {
@@ -32,8 +32,8 @@ pub fn eql(comptime T: type, a: T, b: T) bool {
32
32
  }
33
33
  const acc = @reduce(.Or, a ^ b);
34
34
  const s = @typeInfo(C).int.bits;
35
- const Cu = std.meta.Int(.unsigned, s);
36
- const Cext = std.meta.Int(.unsigned, s + 1);
35
+ const Cu = @Int(.unsigned, s);
36
+ const Cext = @Int(.unsigned, s + 1);
37
37
  return @as(bool, @bitCast(@as(u1, @truncate((@as(Cext, @as(Cu, @bitCast(acc))) -% 1) >> s))));
38
38
  },
39
39
  else => {
@@ -50,7 +50,7 @@ pub fn compare(comptime T: type, a: []const T, b: []const T, endian: Endian) Ord
50
50
  .int => |cinfo| if (cinfo.signedness != .unsigned) @compileError("Elements to be compared must be unsigned") else cinfo.bits,
51
51
  else => @compileError("Elements to be compared must be integers"),
52
52
  };
53
- const Cext = std.meta.Int(.unsigned, bits + 1);
53
+ const Cext = @Int(.unsigned, bits + 1);
54
54
  var gt: T = 0;
55
55
  var eq: T = 1;
56
56
  if (endian == .little) {
package/std/debug.zig CHANGED
@@ -258,6 +258,9 @@ pub const sys_can_stack_trace = switch (builtin.cpu.arch) {
258
258
  .bpfeb,
259
259
  => false,
260
260
 
261
+ // https://codeberg.org/ziglang/zig/issues/31127
262
+ .avr => false,
263
+
261
264
  else => true,
262
265
  };
263
266
 
@@ -517,7 +520,7 @@ pub fn defaultPanic(msg: []const u8, first_trace_addr: ?usize) noreturn {
517
520
 
518
521
  if (uefi.system_table.boot_services) |bs| {
519
522
  // ExitData buffer must be allocated using boot_services.allocatePool (spec: page 220)
520
- const exit_data = uefi.raw_pool_allocator.dupeZ(u16, exit_msg) catch @trap();
523
+ const exit_data = uefi.raw_pool_allocator.dupeSentinel(u16, exit_msg, 0) catch @trap();
521
524
  bs.exit(uefi.handle, .aborted, exit_data) catch {};
522
525
  }
523
526
  @trap();
package/std/enums.zig CHANGED
@@ -1291,7 +1291,7 @@ pub fn EnumIndexer(comptime E: type) type {
1291
1291
  const min_value = std.math.minInt(BackingInt);
1292
1292
  const max_value = std.math.maxInt(BackingInt);
1293
1293
 
1294
- const RangeType = std.meta.Int(.unsigned, @bitSizeOf(BackingInt));
1294
+ const RangeType = @Int(.unsigned, @bitSizeOf(BackingInt));
1295
1295
  pub const count: comptime_int = std.math.maxInt(RangeType) + 1;
1296
1296
 
1297
1297
  pub fn indexOf(e: E) usize {
@@ -1307,7 +1307,7 @@ pub fn EnumIndexer(comptime E: type) type {
1307
1307
  if (backing_int_sign == .unsigned)
1308
1308
  return @enumFromInt(i);
1309
1309
 
1310
- return @enumFromInt(@as(std.meta.Int(.signed, @bitSizeOf(RangeType) + 1), @intCast(i)) + min_value);
1310
+ return @enumFromInt(@as(@Int(.signed, @bitSizeOf(RangeType) + 1), @intCast(i)) + min_value);
1311
1311
  }
1312
1312
  };
1313
1313
  }
@@ -1380,14 +1380,14 @@ test "EnumIndexer non-exhaustive" {
1380
1380
  i4,
1381
1381
  i8,
1382
1382
  i16,
1383
- std.meta.Int(.signed, @bitSizeOf(isize) - 1),
1383
+ @Int(.signed, @bitSizeOf(isize) - 1),
1384
1384
  isize,
1385
1385
  u1,
1386
1386
  u2,
1387
1387
  u3,
1388
1388
  u4,
1389
1389
  u16,
1390
- std.meta.Int(.unsigned, @bitSizeOf(usize) - 1),
1390
+ @Int(.unsigned, @bitSizeOf(usize) - 1),
1391
1391
  usize,
1392
1392
  };
1393
1393
  inline for (backing_ints) |BackingInt| {
@@ -1400,7 +1400,7 @@ test "EnumIndexer non-exhaustive" {
1400
1400
  const min_tag: E = @enumFromInt(std.math.minInt(BackingInt));
1401
1401
  const max_tag: E = @enumFromInt(std.math.maxInt(BackingInt));
1402
1402
 
1403
- const RangedType = std.meta.Int(.unsigned, @bitSizeOf(BackingInt));
1403
+ const RangedType = @Int(.unsigned, @bitSizeOf(BackingInt));
1404
1404
  const max_index: comptime_int = std.math.maxInt(RangedType);
1405
1405
  const number_zero_tag_index: usize = switch (@typeInfo(BackingInt).int.signedness) {
1406
1406
  .unsigned => 0,
@@ -128,7 +128,7 @@ test parseFloat {
128
128
 
129
129
  test "nan and inf" {
130
130
  inline for ([_]type{ f16, f32, f64, f80, f128 }) |T| {
131
- const Z = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
131
+ const Z = @Int(.unsigned, @typeInfo(T).float.bits);
132
132
 
133
133
  try expectEqual(@as(Z, @bitCast(try parseFloat(T, "nAn"))), @as(Z, @bitCast(std.math.nan(T))));
134
134
  try expectEqual(try parseFloat(T, "inF"), std.math.inf(T));
package/std/fmt.zig CHANGED
@@ -433,7 +433,7 @@ fn parseIntWithSign(
433
433
  // accumulate into Accumulate which is always 8 bits or larger. this prevents
434
434
  // `buf_base` from overflowing Result.
435
435
  const info = @typeInfo(Result);
436
- const Accumulate = std.meta.Int(info.int.signedness, @max(8, info.int.bits));
436
+ const Accumulate = @Int(info.int.signedness, @max(8, info.int.bits));
437
437
  var accumulate: Accumulate = 0;
438
438
 
439
439
  if (buf_start[0] == '_' or buf_start[buf_start.len - 1] == '_') return error.InvalidCharacter;
@@ -602,11 +602,6 @@ pub fn bufPrint(buf: []u8, comptime fmt: []const u8, args: anytype) BufPrintErro
602
602
  return w.buffered();
603
603
  }
604
604
 
605
- /// Deprecated in favor of `bufPrintSentinel`
606
- pub fn bufPrintZ(buf: []u8, comptime fmt: []const u8, args: anytype) BufPrintError![:0]u8 {
607
- return try bufPrintSentinel(buf, fmt, args, 0);
608
- }
609
-
610
605
  pub fn bufPrintSentinel(
611
606
  buf: []u8,
612
607
  comptime fmt: []const u8,
@@ -130,7 +130,7 @@ pub const Wyhash = struct {
130
130
 
131
131
  inline fn read(comptime bytes: usize, data: []const u8) u64 {
132
132
  std.debug.assert(bytes <= 8);
133
- const T = std.meta.Int(.unsigned, 8 * bytes);
133
+ const T = @Int(.unsigned, 8 * bytes);
134
134
  return @as(u64, std.mem.readInt(T, data[0..bytes], .little));
135
135
  }
136
136
 
package/std/hash_map.zig CHANGED
@@ -1271,7 +1271,7 @@ pub fn HashMapUnmanaged(
1271
1271
  // map, which is assumed to exist as key_ptr must be valid. This
1272
1272
  // item must be at index 0.
1273
1273
  const idx = if (@sizeOf(K) > 0)
1274
- (key_ptr - self.keys())
1274
+ @as([*]K, @ptrCast(key_ptr)) - self.keys()
1275
1275
  else
1276
1276
  0;
1277
1277
 
@@ -2175,3 +2175,22 @@ test "rehash" {
2175
2175
  }
2176
2176
  }
2177
2177
  }
2178
+
2179
+ test "removeByPtr, key is array" {
2180
+ const gpa = testing.allocator;
2181
+
2182
+ var map: AutoHashMapUnmanaged([2]u32, u32) = .empty;
2183
+ defer map.deinit(gpa);
2184
+
2185
+ const key: [2]u32 = .{ 1, 2 };
2186
+ try map.put(gpa, key, 3);
2187
+
2188
+ try expectEqual(1, map.count());
2189
+ try expectEqual(3, map.get(key));
2190
+
2191
+ const key_ptr = map.getKeyPtr(key).?;
2192
+ map.removeByPtr(key_ptr);
2193
+
2194
+ try expectEqual(0, map.count());
2195
+ try expectEqual(null, map.get(key));
2196
+ }
@@ -189,7 +189,7 @@ pub fn DebugAllocator(comptime config: Config) type {
189
189
  const page_size = config.page_size;
190
190
  const page_align: mem.Alignment = .fromByteUnits(page_size);
191
191
  /// Integer type for pointing to slots in a small allocation
192
- const SlotIndex = std.meta.Int(.unsigned, math.log2(page_size) + 1);
192
+ const SlotIndex = @Int(.unsigned, math.log2(page_size) + 1);
193
193
 
194
194
  const total_requested_bytes_init = if (config.enable_memory_limit) @as(usize, 0) else {};
195
195
  const requested_memory_limit_init = if (config.enable_memory_limit) @as(usize, math.maxInt(usize)) else {};
@@ -4,7 +4,7 @@ const builtin = @import("builtin");
4
4
  const std = @import("std.zig");
5
5
  const root = @import("root");
6
6
 
7
- pub const assembly = @import("builtin/assembly.zig");
7
+ pub const assembly = @import("lang/assembly.zig");
8
8
 
9
9
  /// This data structure is used by the Zig language code generation and
10
10
  /// therefore must be kept in sync with the compiler implementation.
package/std/leb128.zig CHANGED
@@ -9,7 +9,7 @@ const testing = std.testing;
9
9
  /// An example use case of this is in emitting DWARF info where one wants to make a ULEB128 field
10
10
  /// "relocatable", meaning that it becomes possible to later go back and patch the number to be a
11
11
  /// different value without shifting all the following code.
12
- pub fn writeUnsignedFixed(comptime l: usize, ptr: *[l]u8, int: std.meta.Int(.unsigned, l * 7)) void {
12
+ pub fn writeUnsignedFixed(comptime l: usize, ptr: *[l]u8, int: @Int(.unsigned, l * 7)) void {
13
13
  writeUnsignedExtended(ptr, int);
14
14
  }
15
15
 
@@ -65,7 +65,7 @@ test writeUnsignedFixed {
65
65
  /// An example use case of this is in emitting DWARF info where one wants to make a ILEB128 field
66
66
  /// "relocatable", meaning that it becomes possible to later go back and patch the number to be a
67
67
  /// different value without shifting all the following code.
68
- pub fn writeSignedFixed(comptime l: usize, ptr: *[l]u8, int: std.meta.Int(.signed, l * 7)) void {
68
+ pub fn writeSignedFixed(comptime l: usize, ptr: *[l]u8, int: @Int(.signed, l * 7)) void {
69
69
  const T = @TypeOf(int);
70
70
  const U = if (@typeInfo(T).int.bits < 8) u8 else T;
71
71
  var value: U = @intCast(int);
@@ -2047,7 +2047,7 @@ pub const Mutable = struct {
2047
2047
  var limb = switch (signedness) {
2048
2048
  .unsigned => mem.readVarPackedInt(Limb, buffer, bit_index + bit_offset, bit_count - bit_index, endian, .unsigned),
2049
2049
  .signed => b: {
2050
- const SLimb = std.meta.Int(.signed, @bitSizeOf(Limb));
2050
+ const SLimb = @Int(.signed, @bitSizeOf(Limb));
2051
2051
  const limb = mem.readVarPackedInt(SLimb, buffer, bit_index + bit_offset, bit_count - bit_index, endian, .signed);
2052
2052
  break :b @as(Limb, @bitCast(limb));
2053
2053
  },
@@ -2284,7 +2284,7 @@ pub const Const = struct {
2284
2284
  // Make sure -0 is handled correctly.
2285
2285
  if (self.eqlZero()) return 0;
2286
2286
 
2287
- const Unsigned = std.meta.Int(.unsigned, info.bits);
2287
+ const Unsigned = @Int(.unsigned, info.bits);
2288
2288
 
2289
2289
  if (!self.fitsInTwosComp(info.signedness, info.bits)) {
2290
2290
  return error.TargetTooSmall;
package/std/math/big.zig CHANGED
@@ -4,10 +4,10 @@ const assert = std.debug.assert;
4
4
  pub const int = @import("big/int.zig");
5
5
  pub const Limb = usize;
6
6
  const limb_info = @typeInfo(Limb).int;
7
- pub const SignedLimb = std.meta.Int(.signed, limb_info.bits);
8
- pub const DoubleLimb = std.meta.Int(.unsigned, 2 * limb_info.bits);
9
- pub const HalfLimb = std.meta.Int(.unsigned, limb_info.bits / 2);
10
- pub const SignedDoubleLimb = std.meta.Int(.signed, 2 * limb_info.bits);
7
+ pub const SignedLimb = @Int(.signed, limb_info.bits);
8
+ pub const DoubleLimb = @Int(.unsigned, 2 * limb_info.bits);
9
+ pub const HalfLimb = @Int(.unsigned, limb_info.bits / 2);
10
+ pub const SignedDoubleLimb = @Int(.signed, 2 * limb_info.bits);
11
11
  pub const Log2Limb = std.math.Log2Int(Limb);
12
12
 
13
13
  comptime {
@@ -5,7 +5,7 @@ const expect = std.testing.expect;
5
5
  /// Returns a value with the magnitude of `magnitude` and the sign of `sign`.
6
6
  pub fn copysign(magnitude: anytype, sign: @TypeOf(magnitude)) @TypeOf(magnitude) {
7
7
  const T = @TypeOf(magnitude);
8
- const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
8
+ const TBits = @Int(.unsigned, @typeInfo(T).float.bits);
9
9
  const sign_bit_mask = @as(TBits, 1) << (@bitSizeOf(T) - 1);
10
10
  const mag = @as(TBits, @bitCast(magnitude)) & ~sign_bit_mask;
11
11
  const sgn = @as(TBits, @bitCast(sign)) & sign_bit_mask;
@@ -22,16 +22,16 @@ pub fn frexp(x: anytype) Frexp(@TypeOf(x)) {
22
22
  const T: type = @TypeOf(x);
23
23
 
24
24
  const bits: comptime_int = @typeInfo(T).float.bits;
25
- const Int: type = std.meta.Int(.unsigned, bits);
25
+ const Int: type = @Int(.unsigned, bits);
26
26
 
27
27
  const exp_bits: comptime_int = math.floatExponentBits(T);
28
28
  const mant_bits: comptime_int = math.floatMantissaBits(T);
29
29
  const frac_bits: comptime_int = math.floatFractionalBits(T);
30
30
  const exp_min: comptime_int = math.floatExponentMin(T);
31
31
 
32
- const ExpInt: type = std.meta.Int(.unsigned, exp_bits);
33
- const MantInt: type = std.meta.Int(.unsigned, mant_bits);
34
- const FracInt: type = std.meta.Int(.unsigned, frac_bits);
32
+ const ExpInt: type = @Int(.unsigned, exp_bits);
33
+ const MantInt: type = @Int(.unsigned, mant_bits);
34
+ const FracInt: type = @Int(.unsigned, frac_bits);
35
35
 
36
36
  const unreal_exponent: comptime_int = (1 << exp_bits) - 1;
37
37
  const bias: comptime_int = (1 << (exp_bits - 1)) - 2;
@@ -30,7 +30,7 @@ fn ilogbX(comptime T: type, x: T) i32 {
30
30
  const significandBits = math.floatMantissaBits(T);
31
31
  const exponentBits = math.floatExponentBits(T);
32
32
 
33
- const Z = std.meta.Int(.unsigned, typeWidth);
33
+ const Z = @Int(.unsigned, typeWidth);
34
34
 
35
35
  const signBit = (@as(Z, 1) << (significandBits + exponentBits));
36
36
  const maxExponent = ((1 << exponentBits) - 1);
@@ -5,7 +5,7 @@ const expect = std.testing.expect;
5
5
  /// Returns whether x is a finite value.
6
6
  pub fn isFinite(x: anytype) bool {
7
7
  const T = @TypeOf(x);
8
- const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
8
+ const TBits = @Int(.unsigned, @typeInfo(T).float.bits);
9
9
  const remove_sign = ~@as(TBits, 0) >> 1;
10
10
  return @as(TBits, @bitCast(x)) & remove_sign < @as(TBits, @bitCast(math.inf(T)));
11
11
  }
@@ -5,7 +5,7 @@ const expect = std.testing.expect;
5
5
  /// Returns whether x is an infinity, ignoring sign.
6
6
  pub inline fn isInf(x: anytype) bool {
7
7
  const T = @TypeOf(x);
8
- const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
8
+ const TBits = @Int(.unsigned, @typeInfo(T).float.bits);
9
9
  const remove_sign = ~@as(TBits, 0) >> 1;
10
10
  return @as(TBits, @bitCast(x)) & remove_sign == @as(TBits, @bitCast(math.inf(T)));
11
11
  }
@@ -1,7 +1,6 @@
1
1
  const std = @import("../std.zig");
2
2
  const builtin = @import("builtin");
3
3
  const math = std.math;
4
- const meta = std.meta;
5
4
  const expect = std.testing.expect;
6
5
 
7
6
  pub fn isNan(x: anytype) bool {
@@ -12,7 +11,7 @@ pub fn isNan(x: anytype) bool {
12
11
  /// this is tracked by https://github.com/ziglang/zig/issues/14366
13
12
  pub fn isSignalNan(x: anytype) bool {
14
13
  const T = @TypeOf(x);
15
- const U = meta.Int(.unsigned, @bitSizeOf(T));
14
+ const U = @Int(.unsigned, @bitSizeOf(T));
16
15
  const quiet_signal_bit_mask = 1 << (math.floatFractionalBits(T) - 1);
17
16
  return isNan(x) and (@as(U, @bitCast(x)) & quiet_signal_bit_mask == 0);
18
17
  }
@@ -5,7 +5,7 @@ const expect = std.testing.expect;
5
5
  /// Returns whether x is neither zero, subnormal, infinity, or NaN.
6
6
  pub fn isNormal(x: anytype) bool {
7
7
  const T = @TypeOf(x);
8
- const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
8
+ const TBits = @Int(.unsigned, @typeInfo(T).float.bits);
9
9
 
10
10
  const increment_exp = 1 << math.floatMantissaBits(T);
11
11
  const remove_sign = ~@as(TBits, 0) >> 1;
@@ -22,7 +22,7 @@ pub fn isNormal(x: anytype) bool {
22
22
  test isNormal {
23
23
  // TODO add `c_longdouble' when math.inf(T) supports it
24
24
  inline for ([_]type{ f16, f32, f64, f80, f128 }) |T| {
25
- const TBits = std.meta.Int(.unsigned, @bitSizeOf(T));
25
+ const TBits = @Int(.unsigned, @bitSizeOf(T));
26
26
 
27
27
  // normals
28
28
  try expect(isNormal(@as(T, 1.0)));
@@ -6,7 +6,7 @@ const expect = std.testing.expect;
6
6
  pub inline fn isPositiveZero(x: anytype) bool {
7
7
  const T = @TypeOf(x);
8
8
  const bit_count = @typeInfo(T).float.bits;
9
- const TBits = std.meta.Int(.unsigned, bit_count);
9
+ const TBits = @Int(.unsigned, bit_count);
10
10
  return @as(TBits, @bitCast(x)) == @as(TBits, 0);
11
11
  }
12
12
 
@@ -14,7 +14,7 @@ pub inline fn isPositiveZero(x: anytype) bool {
14
14
  pub inline fn isNegativeZero(x: anytype) bool {
15
15
  const T = @TypeOf(x);
16
16
  const bit_count = @typeInfo(T).float.bits;
17
- const TBits = std.meta.Int(.unsigned, bit_count);
17
+ const TBits = @Int(.unsigned, bit_count);
18
18
  return @as(TBits, @bitCast(x)) == @as(TBits, 1) << (bit_count - 1);
19
19
  }
20
20
 
@@ -7,7 +7,7 @@ const expect = std.testing.expect;
7
7
  /// Returns x * 2^n.
8
8
  pub fn ldexp(x: anytype, n: i32) @TypeOf(x) {
9
9
  const T = @TypeOf(x);
10
- const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
10
+ const TBits = @Int(.unsigned, @typeInfo(T).float.bits);
11
11
 
12
12
  const exponent_bits = math.floatExponentBits(T);
13
13
  const mantissa_bits = math.floatMantissaBits(T);
@@ -103,7 +103,7 @@ test ldexp {
103
103
 
104
104
  // Multiplications might flush the denormals to zero, esp. at
105
105
  // runtime, so we manually construct the constants here instead.
106
- const Z = std.meta.Int(.unsigned, @bitSizeOf(T));
106
+ const Z = @Int(.unsigned, @bitSizeOf(T));
107
107
  const EightTimesTrueMin = @as(T, @bitCast(@as(Z, 8)));
108
108
  const TwoTimesTrueMin = @as(T, @bitCast(@as(Z, 2)));
109
109