File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed
Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 66// const Stuff = enum(u8){ foo = 16 };
77//
88// You can get the integer out with a builtin function,
9- // @enumToInt (). We'll learn about builtins properly in a later
9+ // @intFromEnum (). We'll learn about builtins properly in a later
1010// exercise.
1111//
12- // const my_stuff: u8 = @enumToInt (Stuff.foo);
12+ // const my_stuff: u8 = @intFromEnum (Stuff.foo);
1313//
1414// Note how that built-in function starts with "@" just like the
1515// @import() function we've been using.
Original file line number Diff line number Diff line change 44// Ziglings exercise.
55//
66// We've also seen @intCast() in "016_for2.zig", "058_quiz7.zig";
7- // and @enumToInt () in "036_enums2.zig".
7+ // and @intFromEnum () in "036_enums2.zig".
88//
99// Builtins are special because they are intrinsic to the Zig
1010// language itself (as opposed to being provided in the standard
Original file line number Diff line number Diff line change 11//
22// Zig has builtins for mathematical operations such as...
33//
4- // @sqrt @sin @cos
5- // @exp @log @floor
4+ // @sqrt @sin @cos
5+ // @exp @log @floor
66//
77// ...and lots of type casting operations such as...
88//
9- // @as @intToError @intToFloat
10- // @intToPtr @ptrToInt @enumToInt
9+ // @as @errorFromInt @floatFromInt
10+ // @ptrFromInt @intFromPtr @intFromEnum
1111//
1212// Spending part of a rainy day skimming through the complete
1313// list of builtins in the official Zig documentation wouldn't be
You can’t perform that action at this time.
0 commit comments