authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-03-13 14:14:01-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-25 18:54:34-07:00
logc60d33f167494afea808dc0ac9c476422efe22c0
tree9d95ed93f03cc46ea4da9bdfb276f2dbf9314ee5
parent6ad6a58e5dcb2d127f980cfb9d3edd7cf1964852

Configuration: refactor maxInt(u32)


2 files changed, 14 insertions(+), 15 deletions(-)

BRANCH_TODO-1
...@@ -1,4 +1,3 @@...@@ -1,4 +1,3 @@
1* maxInt(u32) -> max_u32
2* replace b.dupe() with string internment1* replace b.dupe() with string internment
3* don't forget to add -listen arg back2* don't forget to add -listen arg back
4* get zig init template working3* get zig init template working
lib/std/Build/Configuration.zig+14-14
...@@ -4,7 +4,7 @@ const std = @import("../std.zig");...@@ -4,7 +4,7 @@ const std = @import("../std.zig");
4const Io = std.Io;4const Io = std.Io;
5const Allocator = std.mem.Allocator;5const Allocator = std.mem.Allocator;
6const assert = std.debug.assert;6const assert = std.debug.assert;
7const maxInt = std.math.maxInt;7const max_u32 = std.math.maxInt(u32);
88
9string_bytes: []u8,9string_bytes: []u8,
10steps: []Step,10steps: []Step,
...@@ -1094,7 +1094,7 @@ pub const LazyPath = union(@This().Tag) {...@@ -1094,7 +1094,7 @@ pub const LazyPath = union(@This().Tag) {
10941094
1095 /// An index into `extra`, or `null`.1095 /// An index into `extra`, or `null`.
1096 pub const OptionalIndex = enum(u32) {1096 pub const OptionalIndex = enum(u32) {
1097 none = maxInt(u32),1097 none = max_u32,
1098 _,1098 _,
10991099
1100 pub fn unwrap(this: @This()) ?Index {1100 pub fn unwrap(this: @This()) ?Index {
...@@ -1149,7 +1149,7 @@ pub const GeneratedFileIndex = enum(u32) {...@@ -1149,7 +1149,7 @@ pub const GeneratedFileIndex = enum(u32) {
1149};1149};
11501150
1151pub const OptionalGeneratedFileIndex = enum(u32) {1151pub const OptionalGeneratedFileIndex = enum(u32) {
1152 none = maxInt(u32),1152 none = max_u32,
1153 _,1153 _,
11541154
1155 pub fn init(i: ?GeneratedFileIndex) OptionalGeneratedFileIndex {1155 pub fn init(i: ?GeneratedFileIndex) OptionalGeneratedFileIndex {
...@@ -1169,7 +1169,7 @@ pub const Package = struct {...@@ -1169,7 +1169,7 @@ pub const Package = struct {
1169 hash: String,1169 hash: String,
11701170
1171 pub const Index = enum(u32) {1171 pub const Index = enum(u32) {
1172 root = maxInt(u32),1172 root = max_u32,
1173 _,1173 _,
11741174
1175 /// Returns `null` for root package.1175 /// Returns `null` for root package.
...@@ -1352,7 +1352,7 @@ pub const ImportTable = struct {...@@ -1352,7 +1352,7 @@ pub const ImportTable = struct {
13521352
1353 /// Points into `extra`.1353 /// Points into `extra`.
1354 pub const Index = enum(u32) {1354 pub const Index = enum(u32) {
1355 invalid = maxInt(u32),1355 invalid = max_u32,
1356 _,1356 _,
13571357
1358 pub fn get(this: @This(), c: *const Configuration) ImportTable {1358 pub fn get(this: @This(), c: *const Configuration) ImportTable {
...@@ -1385,7 +1385,7 @@ pub const Deps = struct {...@@ -1385,7 +1385,7 @@ pub const Deps = struct {
1385///1385///
1386/// Stored identically to `Deps`.1386/// Stored identically to `Deps`.
1387pub const OptionalStringList = enum(u32) {1387pub const OptionalStringList = enum(u32) {
1388 none = maxInt(u32),1388 none = max_u32,
1389 _,1389 _,
13901390
1391 pub fn slice(osl: OptionalStringList, c: *const Configuration) ?[]const String {1391 pub fn slice(osl: OptionalStringList, c: *const Configuration) ?[]const String {
...@@ -1414,11 +1414,11 @@ pub const Path = extern struct {...@@ -1414,11 +1414,11 @@ pub const Path = extern struct {
1414};1414};
14151415
1416pub const InstallDestDir = enum(u32) {1416pub const InstallDestDir = enum(u32) {
1417 none = maxInt(u32) - 4,1417 none = max_u32 - 4,
1418 prefix = maxInt(u32) - 3,1418 prefix = max_u32 - 3,
1419 lib = maxInt(u32) - 2,1419 lib = max_u32 - 2,
1420 bin = maxInt(u32) - 1,1420 bin = max_u32 - 1,
1421 header = maxInt(u32),1421 header = max_u32,
1422 /// A `String` path relative to the prefix.1422 /// A `String` path relative to the prefix.
1423 _,1423 _,
14241424
...@@ -1433,7 +1433,7 @@ pub const OptionalString = enum(u32) {...@@ -1433,7 +1433,7 @@ pub const OptionalString = enum(u32) {
1433 empty = 0,1433 empty = 0,
1434 /// The string "root".1434 /// The string "root".
1435 root = 1,1435 root = 1,
1436 none = maxInt(u32),1436 none = max_u32,
1437 _,1437 _,
14381438
1439 pub fn init(s: String) OptionalString {1439 pub fn init(s: String) OptionalString {
...@@ -1633,7 +1633,7 @@ pub const ResolvedTarget = struct {...@@ -1633,7 +1633,7 @@ pub const ResolvedTarget = struct {
1633 };1633 };
16341634
1635 pub const OptionalIndex = enum(u32) {1635 pub const OptionalIndex = enum(u32) {
1636 none = maxInt(u32),1636 none = max_u32,
1637 _,1637 _,
16381638
1639 pub fn unwrap(this: @This()) ?Index {1639 pub fn unwrap(this: @This()) ?Index {
...@@ -1678,7 +1678,7 @@ pub const TargetQuery = struct {...@@ -1678,7 +1678,7 @@ pub const TargetQuery = struct {
1678 };1678 };
16791679
1680 pub const OptionalIndex = enum(u32) {1680 pub const OptionalIndex = enum(u32) {
1681 none = maxInt(u32),1681 none = max_u32,
1682 _,1682 _,
16831683
1684 pub fn init(i: Index) OptionalIndex {1684 pub fn init(i: Index) OptionalIndex {