@zigc/lib 0.17.0-dev.224 → 0.17.0-dev.242

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 (132) hide show
  1. package/c/math.zig +31 -2
  2. package/compiler/build_runner.zig +1 -1
  3. package/compiler/reduce/Walk.zig +1 -6
  4. package/compiler/resinator/compile.zig +1 -1
  5. package/compiler/resinator/cvtres.zig +4 -4
  6. package/compiler/resinator/ico.zig +4 -4
  7. package/compiler/resinator/parse.zig +2 -2
  8. package/compiler/resinator/res.zig +1 -1
  9. package/compiler/translate-c/ast.zig +11 -21
  10. package/compiler_rt/atomics.zig +1 -1
  11. package/compiler_rt/cos.zig +1 -1
  12. package/compiler_rt/rem_pio2l.zig +1 -1
  13. package/compiler_rt/sin.zig +1 -1
  14. package/compiler_rt/sincos.zig +1 -1
  15. package/compiler_rt/ssp.zig +2 -2
  16. package/compiler_rt/tan.zig +1 -1
  17. package/docs/wasm/Walk.zig +1 -3
  18. package/docs/wasm/html_render.zig +1 -2
  19. package/package.json +1 -1
  20. package/std/Build/Step/ConfigHeader.zig +1 -1
  21. package/std/Io/Kqueue.zig +1 -1
  22. package/std/Io/Reader.zig +0 -5
  23. package/std/Io/Threaded.zig +4 -4
  24. package/std/Io/Writer.zig +1 -2
  25. package/std/Io/net/HostName.zig +11 -6
  26. package/std/Random/ChaCha.zig +2 -2
  27. package/std/Random/benchmark.zig +2 -2
  28. package/std/Thread.zig +2 -2
  29. package/std/base64.zig +5 -5
  30. package/std/bit_set.zig +83 -66
  31. package/std/c.zig +19 -19
  32. package/std/compress/flate/Decompress.zig +1 -1
  33. package/std/crypto/25519/curve25519.zig +2 -2
  34. package/std/crypto/25519/edwards25519.zig +3 -3
  35. package/std/crypto/25519/ristretto255.zig +2 -2
  36. package/std/crypto/25519/scalar.zig +6 -6
  37. package/std/crypto/25519/x25519.zig +1 -1
  38. package/std/crypto/Certificate.zig +1 -1
  39. package/std/crypto/Sha1.zig +1 -1
  40. package/std/crypto/aegis.zig +45 -39
  41. package/std/crypto/aes_ccm.zig +20 -20
  42. package/std/crypto/aes_gcm.zig +10 -12
  43. package/std/crypto/aes_ocb.zig +9 -9
  44. package/std/crypto/argon2.zig +15 -15
  45. package/std/crypto/bcrypt.zig +20 -10
  46. package/std/crypto/benchmark.zig +7 -7
  47. package/std/crypto/blake2.zig +100 -64
  48. package/std/crypto/cbc_mac.zig +1 -1
  49. package/std/crypto/chacha20.zig +10 -10
  50. package/std/crypto/cmac.zig +2 -2
  51. package/std/crypto/codecs/asn1.zig +1 -1
  52. package/std/crypto/codecs/base64_hex_ct.zig +1 -1
  53. package/std/crypto/ecdsa.zig +9 -9
  54. package/std/crypto/ff.zig +2 -2
  55. package/std/crypto/ghash_polyval.zig +4 -4
  56. package/std/crypto/hkdf.zig +1 -1
  57. package/std/crypto/isap.zig +3 -3
  58. package/std/crypto/kangarootwelve.zig +1 -1
  59. package/std/crypto/keccak_p.zig +7 -7
  60. package/std/crypto/md5.zig +1 -1
  61. package/std/crypto/ml_dsa.zig +33 -33
  62. package/std/crypto/ml_kem.zig +4 -4
  63. package/std/crypto/modes.zig +1 -1
  64. package/std/crypto/pbkdf2.zig +1 -1
  65. package/std/crypto/pcurves/p256/scalar.zig +3 -3
  66. package/std/crypto/pcurves/p384/scalar.zig +2 -2
  67. package/std/crypto/pcurves/secp256k1/scalar.zig +3 -3
  68. package/std/crypto/pcurves/tests/p256.zig +5 -5
  69. package/std/crypto/pcurves/tests/p384.zig +5 -5
  70. package/std/crypto/pcurves/tests/secp256k1.zig +3 -3
  71. package/std/crypto/salsa20.zig +8 -8
  72. package/std/crypto/sha2.zig +2 -2
  73. package/std/crypto/sha3.zig +2 -2
  74. package/std/crypto/siphash.zig +1 -1
  75. package/std/crypto/timing_safe.zig +5 -4
  76. package/std/crypto/tls/Client.zig +10 -9
  77. package/std/crypto.zig +3 -3
  78. package/std/debug/Dwarf.zig +1 -1
  79. package/std/debug.zig +6 -4
  80. package/std/elf.zig +1 -1
  81. package/std/enums.zig +3 -3
  82. package/std/fmt/parse_float/decimal.zig +1 -1
  83. package/std/fmt.zig +5 -1
  84. package/std/fs/path.zig +1 -1
  85. package/std/hash/Adler32.zig +3 -3
  86. package/std/hash/benchmark.zig +2 -2
  87. package/std/hash/wyhash.zig +1 -1
  88. package/std/heap/debug_allocator.zig +1 -1
  89. package/std/http.zig +1 -1
  90. package/std/json/static.zig +2 -2
  91. package/std/math/big/int.zig +3 -3
  92. package/std/math/float.zig +62 -0
  93. package/std/math/nextafter.zig +1 -2
  94. package/std/math/powi.zig +2 -3
  95. package/std/math/signbit.zig +0 -1
  96. package/std/math.zig +13 -18
  97. package/std/mem.zig +9 -8
  98. package/std/meta.zig +1 -1
  99. package/std/os/emscripten.zig +2 -2
  100. package/std/os/linux.zig +4 -4
  101. package/std/os/uefi/hii.zig +1 -1
  102. package/std/std.zig +3 -0
  103. package/std/tar/Writer.zig +39 -33
  104. package/std/tar.zig +8 -4
  105. package/std/testing.zig +1 -1
  106. package/std/unicode.zig +13 -8
  107. package/std/zig/Ast/Render.zig +1 -25
  108. package/std/zig/Ast.zig +5 -28
  109. package/std/zig/AstGen.zig +75 -184
  110. package/std/zig/AstRlAnnotate.zig +1 -11
  111. package/std/zig/AstSmith.zig +5 -11
  112. package/std/zig/LibCInstallation.zig +1 -1
  113. package/std/zig/Parse.zig +4 -69
  114. package/std/zig/TokenSmith.zig +0 -6
  115. package/std/zig/WindowsSdk.zig +1 -1
  116. package/std/zig/Zir.zig +0 -54
  117. package/std/zig/ZonGen.zig +0 -1
  118. package/std/zig/llvm/Builder.zig +3 -7
  119. package/std/zig/tokenizer.zig +4 -43
  120. package/std/zig.zig +0 -2
  121. package/compiler_rt/long_double.zig +0 -37
  122. package/libc/mingw/math/lrintl.c +0 -18
  123. package/libc/mingw/math/rintl.c +0 -16
  124. package/libc/musl/src/math/i386/lrintl.c +0 -8
  125. package/libc/musl/src/math/i386/rintl.c +0 -7
  126. package/libc/musl/src/math/lrintl.c +0 -36
  127. package/libc/musl/src/math/rintl.c +0 -29
  128. package/libc/musl/src/math/s390x/rintl.c +0 -15
  129. package/libc/musl/src/math/x32/lrintl.s +0 -7
  130. package/libc/musl/src/math/x32/rintl.s +0 -6
  131. package/libc/musl/src/math/x86_64/lrintl.c +0 -8
  132. package/libc/musl/src/math/x86_64/rintl.c +0 -7
package/c/math.zig CHANGED
@@ -2,6 +2,7 @@ const builtin = @import("builtin");
2
2
 
3
3
  const std = @import("std");
4
4
  const math = std.math;
5
+ const ld = math.long_double;
5
6
 
6
7
  const symbol = @import("../c.zig").symbol;
7
8
 
@@ -35,7 +36,9 @@ comptime {
35
36
  symbol(&frexpl, "frexpl");
36
37
  symbol(&hypotf, "hypotf");
37
38
  symbol(&hypotl, "hypotl");
39
+ symbol(&lrintl, "lrintl");
38
40
  symbol(&modfl, "modfl");
41
+ symbol(&rintl, "rintl");
39
42
  }
40
43
 
41
44
  if ((builtin.target.isMinGW() and @sizeOf(f64) != @sizeOf(c_longdouble)) or builtin.target.isMuslLibC() or builtin.target.isWasiLibC()) {
@@ -254,11 +257,15 @@ fn isnanl(x: c_longdouble) callconv(.c) c_int {
254
257
  }
255
258
 
256
259
  fn lrint(x: f64) callconv(.c) c_long {
257
- return @intFromFloat(rint(x));
260
+ return @trunc(rint(x));
258
261
  }
259
262
 
260
263
  fn lrintf(x: f32) callconv(.c) c_long {
261
- return @intFromFloat(rintf(x));
264
+ return @trunc(rintf(x));
265
+ }
266
+
267
+ fn lrintl(x: c_longdouble) callconv(.c) c_long {
268
+ return @trunc(rintl(x));
262
269
  }
263
270
 
264
271
  fn modfGeneric(comptime T: type, x: T, iptr: *T) T {
@@ -364,6 +371,28 @@ fn rintf(x: f32) callconv(.c) f32 {
364
371
  return y;
365
372
  }
366
373
 
374
+ fn rintl(x: c_longdouble) callconv(.c) c_longdouble {
375
+ if (@typeInfo(c_longdouble).float.bits == 64)
376
+ return rint(x);
377
+
378
+ const toint: c_longdouble = 1 << math.floatFractionalBits(c_longdouble);
379
+ const se = ld.signExponent(x);
380
+
381
+ if (se & 0x7fff >= 0x3fff + math.floatFractionalBits(c_longdouble))
382
+ return x;
383
+
384
+ var y: c_longdouble = undefined;
385
+ if ((se >> 15) == 1) {
386
+ y = x - toint + toint;
387
+ } else {
388
+ y = x + toint - toint;
389
+ }
390
+
391
+ if (y == 0)
392
+ return 0 * x;
393
+ return y;
394
+ }
395
+
367
396
  fn tanh(x: f64) callconv(.c) f64 {
368
397
  return math.tanh(x);
369
398
  }
@@ -1557,7 +1557,7 @@ fn printUsage(b: *std.Build, w: *Writer) !void {
1557
1557
  const name = try fmt.allocPrint(arena, " -D{s}=[{t}]", .{ option.name, option.type_id });
1558
1558
  try w.print("{s:<30} {s}\n", .{ name, option.description });
1559
1559
  if (option.enum_options) |enum_options| {
1560
- const padding = " " ** 33;
1560
+ const padding: [33]u8 = @splat(' ');
1561
1561
  try w.writeAll(padding ++ "Supported Values:\n");
1562
1562
  for (enum_options) |enum_option| {
1563
1563
  try w.print(padding ++ " {s}\n", .{enum_option});
@@ -223,12 +223,8 @@ fn walkExpression(w: *Walk, node: Ast.Node.Index) Error!void {
223
223
  return walkBlock(w, node, statements);
224
224
  },
225
225
 
226
- .@"errdefer" => {
227
- const expr = ast.nodeData(node).opt_token_and_node[1];
228
- return walkExpression(w, expr);
229
- },
230
-
231
226
  .@"defer",
227
+ .@"errdefer",
232
228
  .@"comptime",
233
229
  .@"nosuspend",
234
230
  .@"suspend",
@@ -252,7 +248,6 @@ fn walkExpression(w: *Walk, node: Ast.Node.Index) Error!void {
252
248
  .add_wrap,
253
249
  .add_sat,
254
250
  .array_cat,
255
- .array_mult,
256
251
  .assign,
257
252
  .assign_bit_and,
258
253
  .assign_bit_or,
@@ -3084,7 +3084,7 @@ pub const StringTable = struct {
3084
3084
 
3085
3085
  pub const Block = struct {
3086
3086
  strings: std.ArrayList(Token) = .empty,
3087
- set_indexes: std.bit_set.IntegerBitSet(16) = .{ .mask = 0 },
3087
+ set_indexes: std.bit_set.Integer(16) = .{ .mask = 0 },
3088
3088
  memory_flags: MemoryFlags = MemoryFlags.defaults(res.RT.STRING),
3089
3089
  characteristics: u32,
3090
3090
  version: u32,
@@ -321,7 +321,7 @@ pub fn writeCoff(
321
321
  .checksum = 0,
322
322
  .number = 0,
323
323
  .selection = .NONE,
324
- .unused = .{0} ** 3,
324
+ .unused = @splat(0),
325
325
  });
326
326
 
327
327
  try writeSymbol(writer, .{
@@ -342,7 +342,7 @@ pub fn writeCoff(
342
342
  .checksum = 0,
343
343
  .number = 0,
344
344
  .selection = .NONE,
345
- .unused = .{0} ** 3,
345
+ .unused = @splat(0),
346
346
  });
347
347
 
348
348
  for (resource_symbols) |resource_symbol| {
@@ -353,11 +353,11 @@ pub fn writeCoff(
353
353
  const name_bytes: [8]u8 = name_bytes: {
354
354
  if (external_symbol_name.len > 8) {
355
355
  const string_table_offset: u32 = try string_table.put(allocator, external_symbol_name);
356
- var bytes = [_]u8{0} ** 8;
356
+ var bytes: [8]u8 = @splat(0);
357
357
  std.mem.writeInt(u32, bytes[4..8], string_table_offset, .little);
358
358
  break :name_bytes bytes;
359
359
  } else {
360
- var symbol_shortname = [_]u8{0} ** 8;
360
+ var symbol_shortname: [8]u8 = @splat(0);
361
361
  @memcpy(symbol_shortname[0..external_symbol_name.len], external_symbol_name);
362
362
  break :name_bytes symbol_shortname;
363
363
  }
@@ -183,7 +183,7 @@ pub const Entry = struct {
183
183
  };
184
184
 
185
185
  test "icon" {
186
- const data = "\x00\x00\x01\x00\x01\x00\x10\x10\x00\x00\x01\x00\x10\x00\x10\x00\x00\x00\x16\x00\x00\x00" ++ [_]u8{0} ** 16;
186
+ const data = "\x00\x00\x01\x00\x01\x00\x10\x10\x00\x00\x01\x00\x10\x00\x10\x00\x00\x00\x16\x00\x00\x00" ++ @as([16]u8, @splat(0));
187
187
  var fbs: std.Io.Reader = .fixed(data);
188
188
  const icon = try read(std.testing.allocator, &fbs, data.len);
189
189
  defer icon.deinit();
@@ -196,19 +196,19 @@ test "icon too many images" {
196
196
  // Note that with verifying that all data sizes are within the file bounds and >= 16,
197
197
  // it's not possible to hit EOF when looking for more RESDIR structures, since they are
198
198
  // themselves 16 bytes long, so we'll always hit ImpossibleDataSize instead.
199
- const data = "\x00\x00\x01\x00\x02\x00\x10\x10\x00\x00\x01\x00\x10\x00\x10\x00\x00\x00\x16\x00\x00\x00" ++ [_]u8{0} ** 16;
199
+ const data = "\x00\x00\x01\x00\x02\x00\x10\x10\x00\x00\x01\x00\x10\x00\x10\x00\x00\x00\x16\x00\x00\x00" ++ @as([16]u8, @splat(0));
200
200
  var fbs: std.Io.Reader = .fixed(data);
201
201
  try std.testing.expectError(error.ImpossibleDataSize, read(std.testing.allocator, &fbs, data.len));
202
202
  }
203
203
 
204
204
  test "icon data size past EOF" {
205
- const data = "\x00\x00\x01\x00\x01\x00\x10\x10\x00\x00\x01\x00\x10\x00\x10\x01\x00\x00\x16\x00\x00\x00" ++ [_]u8{0} ** 16;
205
+ const data = "\x00\x00\x01\x00\x01\x00\x10\x10\x00\x00\x01\x00\x10\x00\x10\x01\x00\x00\x16\x00\x00\x00" ++ @as([16]u8, @splat(0));
206
206
  var fbs: std.Io.Reader = .fixed(data);
207
207
  try std.testing.expectError(error.ImpossibleDataSize, read(std.testing.allocator, &fbs, data.len));
208
208
  }
209
209
 
210
210
  test "icon data offset past EOF" {
211
- const data = "\x00\x00\x01\x00\x01\x00\x10\x10\x00\x00\x01\x00\x10\x00\x10\x00\x00\x00\x17\x00\x00\x00" ++ [_]u8{0} ** 16;
211
+ const data = "\x00\x00\x01\x00\x01\x00\x10\x10\x00\x00\x01\x00\x10\x00\x10\x00\x00\x00\x17\x00\x00\x00" ++ @as([16]u8, @splat(0));
212
212
  var fbs: std.Io.Reader = .fixed(data);
213
213
  try std.testing.expectError(error.ImpossibleDataSize, read(std.testing.allocator, &fbs, data.len));
214
214
  }
@@ -138,8 +138,8 @@ pub const Parser = struct {
138
138
  var optional_statements: std.ArrayList(*Node) = .empty;
139
139
 
140
140
  const num_statement_types = @typeInfo(rc.OptionalStatements).@"enum".fields.len;
141
- var statement_type_has_duplicates = [_]bool{false} ** num_statement_types;
142
- var last_statement_per_type = [_]?*Node{null} ** num_statement_types;
141
+ var statement_type_has_duplicates: [num_statement_types]bool = @splat(false);
142
+ var last_statement_per_type: [num_statement_types]?*Node = @splat(null);
143
143
 
144
144
  while (true) {
145
145
  const lookahead_token = try self.lookaheadToken(.normal);
@@ -1068,7 +1068,7 @@ pub const FixedFileInfo = struct {
1068
1068
  pub const key = std.unicode.utf8ToUtf16LeStringLiteral("VS_VERSION_INFO");
1069
1069
 
1070
1070
  pub const Version = struct {
1071
- parts: [4]u16 = [_]u16{0} ** 4,
1071
+ parts: [4]u16 = @splat(0),
1072
1072
 
1073
1073
  pub fn mostSignificantCombinedParts(self: Version) u32 {
1074
1074
  return (@as(u32, self.parts[0]) << 16) + self.parts[1];
@@ -242,7 +242,7 @@ pub const Node = extern union {
242
242
 
243
243
  /// array_type{}
244
244
  empty_array,
245
- /// [1]type{val} ** count
245
+ /// @as([count]type, @splat(val))
246
246
  array_filler,
247
247
 
248
248
  /// comptime { if (!(lhs)) @compileError(rhs); }
@@ -1976,28 +1976,18 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex {
1976
1976
  .array_filler => {
1977
1977
  const payload = node.castTag(.array_filler).?.data;
1978
1978
 
1979
- const type_expr = try renderArrayType(c, 1, payload.type);
1980
- const l_brace = try c.addToken(.l_brace, "{");
1981
- const val = try renderNode(c, payload.filler);
1982
- _ = try c.addToken(.r_brace, "}");
1979
+ const as_tok = try c.addToken(.builtin, "@as");
1980
+ _ = try c.addToken(.l_paren, "(");
1981
+ const type_node = try renderArrayType(c, payload.count, payload.type);
1982
+ _ = try c.addToken(.comma, ",");
1983
+ const splat_node = try renderBuiltinCall(c, "@splat", &.{payload.filler});
1984
+ _ = try c.addToken(.r_paren, ")");
1983
1985
 
1984
- const init = try c.addNode(.{
1985
- .tag = .array_init_one,
1986
- .main_token = l_brace,
1987
- .data = .{ .node_and_node = .{
1988
- type_expr, val,
1989
- } },
1990
- });
1991
1986
  return c.addNode(.{
1992
- .tag = .array_cat,
1993
- .main_token = try c.addToken(.asterisk_asterisk, "**"),
1994
- .data = .{ .node_and_node = .{
1995
- init,
1996
- try c.addNode(.{
1997
- .tag = .number_literal,
1998
- .main_token = try c.addTokenFmt(.number_literal, "{d}", .{payload.count}),
1999
- .data = undefined,
2000
- }),
1987
+ .tag = .builtin_call_two,
1988
+ .main_token = as_tok,
1989
+ .data = .{ .opt_node_and_opt_node = .{
1990
+ .fromOptional(type_node), .fromOptional(splat_node),
2001
1991
  } },
2002
1992
  });
2003
1993
  },
@@ -94,7 +94,7 @@ const SpinlockTable = struct {
94
94
  }
95
95
  };
96
96
 
97
- list: [max_spinlocks]Spinlock = [_]Spinlock{.{}} ** max_spinlocks,
97
+ list: [max_spinlocks]Spinlock = @splat(.{}),
98
98
 
99
99
  // The spinlock table behaves as a really simple hash table, mapping
100
100
  // addresses to spinlocks. The mapping is not unique but that's only a
@@ -7,6 +7,7 @@
7
7
 
8
8
  const std = @import("std");
9
9
  const math = std.math;
10
+ const ld = math.long_double;
10
11
  const mem = std.mem;
11
12
  const expect = std.testing.expect;
12
13
  const expectApproxEqAbs = std.testing.expectApproxEqAbs;
@@ -17,7 +18,6 @@ const trig = @import("trig.zig");
17
18
  const rem_pio2 = @import("rem_pio2.zig").rem_pio2;
18
19
  const rem_pio2f = @import("rem_pio2f.zig").rem_pio2f;
19
20
  const rem_pio2l = @import("rem_pio2l.zig").rem_pio2l;
20
- const ld = @import("long_double.zig");
21
21
 
22
22
  comptime {
23
23
  symbol(&cosh, "__cosh");
@@ -5,8 +5,8 @@
5
5
 
6
6
  const std = @import("std");
7
7
  const math = std.math;
8
+ const ld = math.long_double;
8
9
 
9
- const ld = @import("long_double.zig");
10
10
  const rem_pio2_large = @import("rem_pio2_large.zig").rem_pio2_large;
11
11
 
12
12
  pub fn rem_pio2l(comptime T: type, x: T, y: *[2]T) i32 {
@@ -7,6 +7,7 @@
7
7
 
8
8
  const std = @import("std");
9
9
  const math = std.math;
10
+ const ld = math.long_double;
10
11
  const mem = std.mem;
11
12
  const expect = std.testing.expect;
12
13
  const expectApproxEqAbs = std.testing.expectApproxEqAbs;
@@ -17,7 +18,6 @@ const trig = @import("trig.zig");
17
18
  const rem_pio2 = @import("rem_pio2.zig").rem_pio2;
18
19
  const rem_pio2f = @import("rem_pio2f.zig").rem_pio2f;
19
20
  const rem_pio2l = @import("rem_pio2l.zig").rem_pio2l;
20
- const ld = @import("long_double.zig");
21
21
 
22
22
  comptime {
23
23
  symbol(&sinh, "__sinh");
@@ -2,6 +2,7 @@ const std = @import("std");
2
2
  const builtin = @import("builtin");
3
3
  const arch = builtin.cpu.arch;
4
4
  const math = std.math;
5
+ const ld = math.long_double;
5
6
  const mem = std.mem;
6
7
  const expect = std.testing.expect;
7
8
  const expectApproxEqAbs = std.testing.expectApproxEqAbs;
@@ -9,7 +10,6 @@ const trig = @import("trig.zig");
9
10
  const rem_pio2 = @import("rem_pio2.zig").rem_pio2;
10
11
  const rem_pio2f = @import("rem_pio2f.zig").rem_pio2f;
11
12
  const rem_pio2l = @import("rem_pio2l.zig").rem_pio2l;
12
- const ld = @import("long_double.zig");
13
13
  const compiler_rt = @import("../compiler_rt.zig");
14
14
  const symbol = compiler_rt.symbol;
15
15
 
@@ -44,10 +44,10 @@ fn __chk_fail() callconv(.c) noreturn {
44
44
 
45
45
  // TODO: Initialize the canary with random data
46
46
  var __stack_chk_guard: usize = blk: {
47
- var buf = [1]u8{0} ** @sizeOf(usize);
47
+ var buf: [@sizeOf(usize)]u8 = @splat(0);
48
48
  buf[@sizeOf(usize) - 1] = 255;
49
49
  buf[@sizeOf(usize) - 2] = '\n';
50
- break :blk @as(usize, @bitCast(buf));
50
+ break :blk @bitCast(buf);
51
51
  };
52
52
 
53
53
  fn __strcpy_chk(dest: [*:0]u8, src: [*:0]const u8, dest_n: usize) callconv(.c) [*:0]u8 {
@@ -9,6 +9,7 @@
9
9
  const std = @import("std");
10
10
  const builtin = @import("builtin");
11
11
  const math = std.math;
12
+ const ld = math.long_double;
12
13
  const mem = std.mem;
13
14
  const expect = std.testing.expect;
14
15
  const expectApproxEqAbs = std.testing.expectApproxEqAbs;
@@ -17,7 +18,6 @@ const kernel = @import("trig.zig");
17
18
  const rem_pio2 = @import("rem_pio2.zig").rem_pio2;
18
19
  const rem_pio2f = @import("rem_pio2f.zig").rem_pio2f;
19
20
  const rem_pio2l = @import("rem_pio2l.zig").rem_pio2l;
20
- const ld = @import("long_double.zig");
21
21
 
22
22
  const arch = builtin.cpu.arch;
23
23
  const compiler_rt = @import("../compiler_rt.zig");
@@ -709,7 +709,6 @@ fn expr(w: *Walk, scope: *Scope, parent_decl: Decl.Index, node: Ast.Node.Index)
709
709
  .less_or_equal,
710
710
  .array_cat,
711
711
 
712
- .array_mult,
713
712
  .error_union,
714
713
  .merge_error_sets,
715
714
  .bool_and,
@@ -1014,8 +1013,7 @@ fn block(
1014
1013
 
1015
1014
  .grouped_expression => try expr(w, scope, parent_decl, ast.nodeData(node).node_and_token[0]),
1016
1015
 
1017
- .@"defer" => try expr(w, scope, parent_decl, ast.nodeData(node).node),
1018
- .@"errdefer" => try expr(w, scope, parent_decl, ast.nodeData(node).opt_token_and_node[1]),
1016
+ .@"defer", .@"errdefer" => try expr(w, scope, parent_decl, ast.nodeData(node).node),
1019
1017
 
1020
1018
  else => try expr(w, scope, parent_decl, node),
1021
1019
  }
@@ -302,7 +302,6 @@ pub fn fileSourceHtml(
302
302
  .minus_pipe_equal,
303
303
  .asterisk,
304
304
  .asterisk_equal,
305
- .asterisk_asterisk,
306
305
  .asterisk_percent,
307
306
  .asterisk_percent_equal,
308
307
  .asterisk_pipe,
@@ -328,7 +327,7 @@ pub fn fileSourceHtml(
328
327
  .tilde,
329
328
  => try appendEscaped(out, slice),
330
329
 
331
- .invalid, .invalid_periodasterisks => return error.InvalidToken,
330
+ .invalid => return error.InvalidToken,
332
331
  }
333
332
  }
334
333
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zigc/lib",
3
- "version": "0.17.0-dev.224",
3
+ "version": "0.17.0-dev.242",
4
4
  "description": "Zig standard library and libc headers (shared across all platforms)",
5
5
  "repository": {
6
6
  "type": "git",
@@ -290,7 +290,7 @@ fn render_autoconf_undef(
290
290
  const build = step.owner;
291
291
  const allocator = build.allocator;
292
292
 
293
- var is_used: std.DynamicBitSetUnmanaged = try .initEmpty(allocator, values.count());
293
+ var is_used: std.bit_set.Dynamic = try .initEmpty(allocator, values.count());
294
294
  defer is_used.deinit(allocator);
295
295
 
296
296
  var any_errors = false;
package/std/Io/Kqueue.zig CHANGED
@@ -79,7 +79,7 @@ const Fiber = struct {
79
79
  awaiter: ?*Fiber,
80
80
  queue_next: ?*Fiber,
81
81
  cancel_thread: ?*Thread,
82
- awaiting_completions: std.StaticBitSet(3),
82
+ awaiting_completions: std.bit_set.Static(3),
83
83
 
84
84
  const finished: ?*Fiber = @ptrFromInt(@alignOf(Thread));
85
85
 
package/std/Io/Reader.zig CHANGED
@@ -2097,7 +2097,6 @@ test "deserialize signed LEB128" {
2097
2097
  try testing.expectEqual(std.math.minInt(i128), testLeb128(i128, "\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x7E"));
2098
2098
 
2099
2099
  // Specific cases
2100
- try testing.expectEqual(0, testLeb128(i0, "\x00"));
2101
2100
  try testing.expectEqual(0, testLeb128(i2, "\x00"));
2102
2101
  try testing.expectEqual(0, testLeb128(i8, "\x00"));
2103
2102
 
@@ -2134,8 +2133,6 @@ test "deserialize signed LEB128" {
2134
2133
  try testing.expectError(error.EndOfStream, testLeb128(i128, &end_of_stream));
2135
2134
 
2136
2135
  // Overflow
2137
- try testing.expectError(error.Overflow, testLeb128(i0, "\x01"));
2138
- try testing.expectError(error.Overflow, testLeb128(i0, "\x7F"));
2139
2136
  try testing.expectError(error.Overflow, testLeb128(i8, "\x80\x01"));
2140
2137
  try testing.expectError(error.Overflow, testLeb128(i8, "\xFF\x7E"));
2141
2138
  try testing.expectError(error.Overflow, testLeb128(i8, "\x80\x80\x40"));
@@ -2145,7 +2142,6 @@ test "deserialize signed LEB128" {
2145
2142
  try testing.expectError(error.Overflow, testLeb128(i64, "\x80\x80\x80\x80\x80\x80\x80\x80\x80\x01"));
2146
2143
  try testing.expectError(error.Overflow, testLeb128(i64, "\x80\x80\x80\x80\x80\x80\x80\x80\x80\x40"));
2147
2144
 
2148
- try testing.expectError(error.Overflow, testLeb128(i0, &overflow));
2149
2145
  try testing.expectError(error.Overflow, testLeb128(i7, &overflow));
2150
2146
  try testing.expectError(error.Overflow, testLeb128(i8, &overflow));
2151
2147
  try testing.expectError(error.Overflow, testLeb128(i14, &overflow));
@@ -2159,7 +2155,6 @@ test "deserialize signed LEB128" {
2159
2155
  try testing.expectEqual(0x80, testLeb128(i64, "\x80\x81\x00"));
2160
2156
  try testing.expectEqual(0x80, testLeb128(i64, "\x80\x81\x80\x00"));
2161
2157
 
2162
- try testing.expectEqual(0, testLeb128(i0, &long_zero));
2163
2158
  try testing.expectEqual(0, testLeb128(i7, &long_zero));
2164
2159
  try testing.expectEqual(0, testLeb128(i8, &long_zero));
2165
2160
  try testing.expectEqual(0, testLeb128(i14, &long_zero));
@@ -6329,7 +6329,7 @@ pub fn GetFinalPathNameByHandle(
6329
6329
  const MIN_SIZE = @sizeOf(windows.MOUNTMGR_MOUNT_POINT) + windows.MAX_PATH;
6330
6330
  // We initialize the input buffer to all zeros for convenience since
6331
6331
  // `DeviceIoControl` with `IOCTL_MOUNTMGR_QUERY_POINTS` expects this.
6332
- var input_buf: [MIN_SIZE]u8 align(@alignOf(windows.MOUNTMGR_MOUNT_POINT)) = [_]u8{0} ** MIN_SIZE;
6332
+ var input_buf: [MIN_SIZE]u8 align(@alignOf(windows.MOUNTMGR_MOUNT_POINT)) = @splat(0);
6333
6333
  var output_buf: [MIN_SIZE * 4]u8 align(@alignOf(windows.MOUNTMGR_MOUNT_POINTS)) = undefined;
6334
6334
 
6335
6335
  // This surprising path is a filesystem path to the mount manager on Windows.
@@ -6409,7 +6409,7 @@ pub fn GetFinalPathNameByHandle(
6409
6409
 
6410
6410
  // 49 is the maximum length accepted by mountmgrIsVolumeName
6411
6411
  const vol_input_size = @sizeOf(windows.MOUNTMGR_TARGET_NAME) + (49 * 2);
6412
- var vol_input_buf: [vol_input_size]u8 align(@alignOf(windows.MOUNTMGR_TARGET_NAME)) = [_]u8{0} ** vol_input_size;
6412
+ var vol_input_buf: [vol_input_size]u8 align(@alignOf(windows.MOUNTMGR_TARGET_NAME)) = @splat(0);
6413
6413
  // Note: If the path exceeds MAX_PATH, the Disk Management GUI doesn't accept the full path,
6414
6414
  // and instead if must be specified using a shortened form (e.g. C:\FOO~1\BAR~1\<...>).
6415
6415
  // However, just to be sure we can handle any path length, we use PATH_MAX_WIDE here.
@@ -8914,7 +8914,7 @@ fn isCygwinPty(file: File) Io.Cancelable!bool {
8914
8914
  // we can use this smaller buffer and just return false on any error from
8915
8915
  // NtQueryInformationFile.
8916
8916
  const num_name_bytes = windows.MAX_PATH * 2;
8917
- var name_info_bytes align(@alignOf(windows.FILE.NAME_INFORMATION)) = [_]u8{0} ** (name_bytes_offset + num_name_bytes);
8917
+ var name_info_bytes: [name_bytes_offset + num_name_bytes]u8 align(@alignOf(windows.FILE.NAME_INFORMATION)) = @splat(0);
8918
8918
 
8919
8919
  var io_status_block: windows.IO_STATUS_BLOCK = undefined;
8920
8920
  const syscall: Syscall = try .start();
@@ -16191,7 +16191,7 @@ fn windowsCreateProcessPathExt(
16191
16191
  var io_status: windows.IO_STATUS_BLOCK = undefined;
16192
16192
 
16193
16193
  const num_supported_pathext = @typeInfo(process.WindowsExtension).@"enum".fields.len;
16194
- var pathext_seen = [_]bool{false} ** num_supported_pathext;
16194
+ var pathext_seen: [num_supported_pathext]bool = @splat(false);
16195
16195
  var any_pathext_seen = false;
16196
16196
  var unappended_exists = false;
16197
16197
 
package/std/Io/Writer.zig CHANGED
@@ -781,7 +781,7 @@ test splatByteAll {
781
781
  defer aw.deinit();
782
782
 
783
783
  try aw.writer.splatByteAll('7', 45);
784
- try testing.expectEqualStrings("7" ** 45, aw.writer.buffered());
784
+ try testing.expectEqualStrings(&@as([45]u8, @splat('7')), aw.writer.buffered());
785
785
  }
786
786
 
787
787
  pub fn splatBytePreserve(w: *Writer, preserve: usize, byte: u8, n: usize) Error!void {
@@ -1924,7 +1924,6 @@ test "serialize signed LEB128" {
1924
1924
  try testLeb128Encoding(i128, std.math.minInt(i128), "\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x7E");
1925
1925
 
1926
1926
  // Specific cases
1927
- try testLeb128Encoding(i0, 0, "\x00");
1928
1927
  try testLeb128Encoding(i8, 0, "\x00");
1929
1928
 
1930
1929
  try testLeb128Encoding(i2, -1, "\x7F");
@@ -76,9 +76,14 @@ test validate {
76
76
  try validate("a-b.com");
77
77
  try validate("a.b.c.d.e.f.g");
78
78
  try validate("127.0.0.1"); // Also a valid hostname
79
- try validate("a" ** 63 ++ ".com"); // Label exactly 63 chars (valid)
80
- try validate("a." ** 127 ++ "a"); // Total length 255 (valid)
81
- try validate("a." ** 127 ++ "a."); // Total length 255 + trailing dot (valid)
79
+
80
+ const many_a: [63]u8 = @splat('a');
81
+ try validate(&many_a ++ ".com"); // Label exactly 63 chars (valid)
82
+
83
+ const many_a_dot_buf: [127][2]u8 = @splat(.{ 'a', '.' });
84
+ const many_a_dot: []const u8 = @ptrCast(&many_a_dot_buf);
85
+ try validate(many_a_dot ++ "a"); // Total length 255 (valid)
86
+ try validate(many_a_dot ++ "a."); // Total length 255 + trailing dot (valid)
82
87
 
83
88
  // Invalid hostnames
84
89
  try std.testing.expectError(error.InvalidHostName, validate(""));
@@ -92,9 +97,9 @@ test validate {
92
97
  try std.testing.expectError(error.InvalidHostName, validate("host_name.com"));
93
98
  try std.testing.expectError(error.InvalidHostName, validate("."));
94
99
  try std.testing.expectError(error.InvalidHostName, validate(".."));
95
- try std.testing.expectError(error.InvalidHostName, validate("a" ** 64 ++ ".com")); // Label length 64 (too long)
96
- try std.testing.expectError(error.NameTooLong, validate("a." ** 127 ++ "ab")); // Total length 256 (too long)
97
- try std.testing.expectError(error.NameTooLong, validate("a." ** 127 ++ "ab.")); // Total length 256 + trailing dot (too long)
100
+ try std.testing.expectError(error.InvalidHostName, validate(&many_a ++ "a.com")); // Label length 64 (too long)
101
+ try std.testing.expectError(error.NameTooLong, validate(many_a_dot ++ "ab")); // Total length 256 (too long)
102
+ try std.testing.expectError(error.NameTooLong, validate(many_a_dot ++ "ab.")); // Total length 256 + trailing dot (too long)
98
103
  }
99
104
 
100
105
  pub fn init(bytes: []const u8) ValidateError!HostName {
@@ -14,7 +14,7 @@ const State = [8 * Cipher.block_length]u8;
14
14
  state: State,
15
15
  offset: usize,
16
16
 
17
- const nonce = [_]u8{0} ** Cipher.nonce_length;
17
+ const nonce: [Cipher.nonce_length]u8 = @splat(0);
18
18
 
19
19
  pub const secret_seed_length = Cipher.key_length;
20
20
 
@@ -38,7 +38,7 @@ pub fn addEntropy(self: *Self, bytes: []const u8) void {
38
38
  );
39
39
  }
40
40
  if (i < bytes.len) {
41
- var k = [_]u8{0} ** Cipher.key_length;
41
+ var k: [Cipher.key_length]u8 = @splat(0);
42
42
  const src = bytes[i..];
43
43
  @memcpy(k[0..src.len], src);
44
44
  Cipher.xor(
@@ -55,12 +55,12 @@ const csprngs = [_]Rng{
55
55
  Rng{
56
56
  .ty = Random.Ascon,
57
57
  .name = "ascon",
58
- .init_u8s = &[_]u8{0} ** 32,
58
+ .init_u8s = &@as([32]u8, @splat(0)),
59
59
  },
60
60
  Rng{
61
61
  .ty = Random.ChaCha,
62
62
  .name = "chacha",
63
- .init_u8s = &[_]u8{0} ** 32,
63
+ .init_u8s = &@as([32]u8, @splat(0)),
64
64
  },
65
65
  };
66
66
 
package/std/Thread.zig CHANGED
@@ -1574,9 +1574,9 @@ const LinuxThreadImpl = struct {
1574
1574
  };
1575
1575
 
1576
1576
  fn testThreadName(io: Io, thread: *Thread) !void {
1577
- const testCases = &[_][]const u8{
1577
+ const testCases: []const []const u8 = &.{
1578
1578
  "mythread",
1579
- "b" ** max_name_len,
1579
+ &@as([max_name_len]u8, @splat('b')),
1580
1580
  };
1581
1581
 
1582
1582
  inline for (testCases) |tc| {
package/std/base64.zig CHANGED
@@ -86,7 +86,7 @@ pub const Base64Encoder = struct {
86
86
  /// A bunch of assertions, then simply pass the data right through.
87
87
  pub fn init(alphabet_chars: [64]u8, pad_char: ?u8) Base64Encoder {
88
88
  assert(alphabet_chars.len == 64);
89
- var char_in_alphabet = [_]bool{false} ** 256;
89
+ var char_in_alphabet: [256]bool = @splat(false);
90
90
  for (alphabet_chars) |c| {
91
91
  assert(!char_in_alphabet[c]);
92
92
  assert(pad_char == null or c != pad_char.?);
@@ -176,12 +176,12 @@ pub const Base64Decoder = struct {
176
176
 
177
177
  pub fn init(alphabet_chars: [64]u8, pad_char: ?u8) Base64Decoder {
178
178
  var result = Base64Decoder{
179
- .char_to_index = [_]u8{invalid_char} ** 256,
180
- .fast_char_to_index = .{[_]u32{invalid_char_tst} ** 256} ** 4,
179
+ .char_to_index = @splat(invalid_char),
180
+ .fast_char_to_index = @splat(@splat(invalid_char_tst)),
181
181
  .pad_char = pad_char,
182
182
  };
183
183
 
184
- var char_in_alphabet = [_]bool{false} ** 256;
184
+ var char_in_alphabet: [256]bool = @splat(false);
185
185
  for (alphabet_chars, 0..) |c, i| {
186
186
  assert(!char_in_alphabet[c]);
187
187
  assert(pad_char == null or c != pad_char.?);
@@ -302,7 +302,7 @@ pub const Base64DecoderWithIgnore = struct {
302
302
  pub fn init(alphabet_chars: [64]u8, pad_char: ?u8, ignore_chars: []const u8) Base64DecoderWithIgnore {
303
303
  var result = Base64DecoderWithIgnore{
304
304
  .decoder = Base64Decoder.init(alphabet_chars, pad_char),
305
- .char_is_ignored = [_]bool{false} ** 256,
305
+ .char_is_ignored = @splat(false),
306
306
  };
307
307
  for (ignore_chars) |c| {
308
308
  assert(result.decoder.char_to_index[c] == Base64Decoder.invalid_char);