Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function

initSigned

Public Function
std.Build.Configuration.Step.ConfigHeader.Value.initSigned
pub fn initSigned(x: i64) @This()

Params

  • x: i64

File

Build/Configuration.zig:1174
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
            pub fn initSigned(x: i64) @This() {
                return switch (x) {
                    0 => unreachable, // should have been an Index
                    1 => unreachable, // should have been an Index
                    2...std.math.maxInt(u29) => .{
                        .flags = .{
                            .tag = .small_unsigned,
                            .small = @intCast(x),
                        },
                        .i64 = .{ .value = null },
                        .u64 = .{ .value = null },
                        .ident = .{ .value = null },
                        .string = .{ .value = null },
                    },
                    std.math.minInt(i29)...-1 => .{
                        .flags = .{
                            .tag = .small_signed,
                            .small = @bitCast(@as(i29, @intCast(x))),
                        },
                        .i64 = .{ .value = null },
                        .u64 = .{ .value = null },
                        .ident = .{ .value = null },
                        .string = .{ .value = null },
                    },
                    else => .{
                        .flags = .{
                            .tag = .i64,
                            .small = 0,
                        },
                        .i64 = .{ .value = x },
                        .u64 = .{ .value = null },
                        .ident = .{ .value = null },
                        .string = .{ .value = null },
                    },
                };
            }