authorgravatar for bertie@wheen.onlineBertie Wheen <bertie@wheen.online> 2023-06-28 10:22:32+01:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2023-06-28 17:38:41+03:00
log7166407d8f2e9e080f4f97926a2b543150261576
tree9950c1020007d41624da7440269d8c282e9a9396
parent4620972d086ebb3b7686a79914876488c6dfd171

langref: correct ordering of @xFromY builtins


1 files changed, 84 insertions(+), 84 deletions(-)

doc/langref.html.in+84-84
......@@ -6641,19 +6641,19 @@ test "coercion from homogenous tuple to array" {
66416641 <ul>
66426642 <li>{#link|@bitCast#} - change type but maintain bit representation</li>
66436643 <li>{#link|@alignCast#} - make a pointer have more alignment</li>
6644 <li>{#link|@enumFromInt#} - obtain an enum value based on its integer tag value</li>
6645 <li>{#link|@errorFromInt#} - obtain an error code based on its integer value</li>
6646 <li>{#link|@errSetCast#} - convert to a smaller error set</li>
6647 <li>{#link|@floatCast#} - convert a larger float to a smaller float</li>
6648 <li>{#link|@floatFromInt#} - convert an integer to a float value</li>
6649 <li>{#link|@intCast#} - convert between integer types</li>
66446650 <li>{#link|@intFromBool#} - convert true to 1 and false to 0</li>
66456651 <li>{#link|@intFromEnum#} - obtain the integer tag value of an enum or tagged union</li>
6646 <li>{#link|@errSetCast#} - convert to a smaller error set</li>
66476652 <li>{#link|@intFromError#} - obtain the integer value of an error code</li>
6648 <li>{#link|@floatCast#} - convert a larger float to a smaller float</li>
66496653 <li>{#link|@intFromFloat#} - obtain the integer part of a float value</li>
6650 <li>{#link|@intCast#} - convert between integer types</li>
6651 <li>{#link|@enumFromInt#} - obtain an enum value based on its integer tag value</li>
6652 <li>{#link|@errorFromInt#} - obtain an error code based on its integer value</li>
6653 <li>{#link|@floatFromInt#} - convert an integer to a float value</li>
6654 <li>{#link|@intFromPtr#} - obtain the address of a pointer</li>
66546655 <li>{#link|@ptrFromInt#} - convert an address to a pointer</li>
66556656 <li>{#link|@ptrCast#} - convert between pointer types</li>
6656 <li>{#link|@intFromPtr#} - obtain the address of a pointer</li>
66576657 <li>{#link|@truncate#} - convert between integer types, chopping off bits</li>
66586658 </ul>
66596659 {#header_close#}
......@@ -7902,14 +7902,6 @@ comptime {
79027902 {#see_also|@offsetOf#}
79037903 {#header_close#}
79047904
7905 {#header_open|@intFromBool#}
7906 <pre>{#syntax#}@intFromBool(value: bool) u1{#endsyntax#}</pre>
7907 <p>
7908 Converts {#syntax#}true{#endsyntax#} to {#syntax#}@as(u1, 1){#endsyntax#} and {#syntax#}false{#endsyntax#} to
7909 {#syntax#}@as(u1, 0){#endsyntax#}.
7910 </p>
7911 {#header_close#}
7912
79137905 {#header_open|@bitSizeOf#}
79147906 <pre>{#syntax#}@bitSizeOf(comptime T: type) comptime_int{#endsyntax#}</pre>
79157907 <p>
......@@ -8351,6 +8343,7 @@ test "main" {
83518343 <p>For a function that returns a possible error code, use {#syntax#}@import("std").math.divTrunc{#endsyntax#}.</p>
83528344 {#see_also|@divFloor|@divExact#}
83538345 {#header_close#}
8346
83548347 {#header_open|@embedFile#}
83558348 <pre>{#syntax#}@embedFile(comptime path: []const u8) *const [N:0]u8{#endsyntax#}</pre>
83568349 <p>
......@@ -8366,17 +8359,32 @@ test "main" {
83668359 {#see_also|@import#}
83678360 {#header_close#}
83688361
8369 {#header_open|@intFromEnum#}
8370 <pre>{#syntax#}@intFromEnum(enum_or_tagged_union: anytype) anytype{#endsyntax#}</pre>
8362 {#header_open|@enumFromInt#}
8363 <pre>{#syntax#}@enumFromInt(integer: anytype) anytype{#endsyntax#}</pre>
83718364 <p>
8372 Converts an enumeration value into its integer tag type. When a tagged union is passed,
8373 the tag value is used as the enumeration value.
8365 Converts an integer into an {#link|enum#} value. The return type is the inferred result type.
83748366 </p>
83758367 <p>
8376 If there is only one possible enum value, the result is a {#syntax#}comptime_int{#endsyntax#}
8377 known at {#link|comptime#}.
8368 Attempting to convert an integer which represents no value in the chosen enum type invokes
8369 safety-checked {#link|Undefined Behavior#}.
83788370 </p>
8379 {#see_also|@enumFromInt#}
8371 {#see_also|@intFromEnum#}
8372 {#header_close#}
8373
8374 {#header_open|@errorFromInt#}
8375 <pre>{#syntax#}@errorFromInt(value: std.meta.Int(.unsigned, @sizeOf(anyerror) * 8)) anyerror{#endsyntax#}</pre>
8376 <p>
8377 Converts from the integer representation of an error into {#link|The Global Error Set#} type.
8378 </p>
8379 <p>
8380 It is generally recommended to avoid this
8381 cast, as the integer representation of an error is not stable across source code changes.
8382 </p>
8383 <p>
8384 Attempting to convert an integer that does not correspond to any error results in
8385 safety-protected {#link|Undefined Behavior#}.
8386 </p>
8387 {#see_also|@intFromError#}
83808388 {#header_close#}
83818389
83828390 {#header_open|@errorName#}
......@@ -8401,26 +8409,6 @@ test "main" {
84018409 </p>
84028410 {#header_close#}
84038411
8404 {#header_open|@intFromError#}
8405 <pre>{#syntax#}@intFromError(err: anytype) std.meta.Int(.unsigned, @sizeOf(anyerror) * 8){#endsyntax#}</pre>
8406 <p>
8407 Supports the following types:
8408 </p>
8409 <ul>
8410 <li>{#link|The Global Error Set#}</li>
8411 <li>{#link|Error Set Type#}</li>
8412 <li>{#link|Error Union Type#}</li>
8413 </ul>
8414 <p>
8415 Converts an error to the integer representation of an error.
8416 </p>
8417 <p>
8418 It is generally recommended to avoid this
8419 cast, as the integer representation of an error is not stable across source code changes.
8420 </p>
8421 {#see_also|@errorFromInt#}
8422 {#header_close#}
8423
84248412 {#header_open|@errSetCast#}
84258413 <pre>{#syntax#}@errSetCast(value: anytype) anytype{#endsyntax#}</pre>
84268414 <p>
......@@ -8545,16 +8533,12 @@ test "decl access by string" {
85458533 </p>
85468534 {#header_close#}
85478535
8548 {#header_open|@intFromFloat#}
8549 <pre>{#syntax#}@intFromFloat(float: anytype) anytype{#endsyntax#}</pre>
8550 <p>
8551 Converts the integer part of a floating point number to the inferred result type.
8552 </p>
8536 {#header_open|@floatFromInt#}
8537 <pre>{#syntax#}@floatFromInt(int: anytype) anytype{#endsyntax#}</pre>
85538538 <p>
8554 If the integer part of the floating point number cannot fit in the destination type,
8555 it invokes safety-checked {#link|Undefined Behavior#}.
8539 Converts an integer to the closest floating point representation. The return type is the inferred result type.
8540 To convert the other way, use {#link|@intFromFloat#}. This cast is always safe.
85568541 </p>
8557 {#see_also|@floatFromInt#}
85588542 {#header_close#}
85598543
85608544 {#header_open|@frameAddress#}
......@@ -8686,54 +8670,66 @@ test "integer cast panic" {
86868670 </p>
86878671 {#header_close#}
86888672
8689 {#header_open|@enumFromInt#}
8690 <pre>{#syntax#}@enumFromInt(integer: anytype) anytype{#endsyntax#}</pre>
8673 {#header_open|@intFromBool#}
8674 <pre>{#syntax#}@intFromBool(value: bool) u1{#endsyntax#}</pre>
86918675 <p>
8692 Converts an integer into an {#link|enum#} value. The return type is the inferred result type.
8676 Converts {#syntax#}true{#endsyntax#} to {#syntax#}@as(u1, 1){#endsyntax#} and {#syntax#}false{#endsyntax#} to
8677 {#syntax#}@as(u1, 0){#endsyntax#}.
86938678 </p>
8679 {#header_close#}
8680
8681 {#header_open|@intFromEnum#}
8682 <pre>{#syntax#}@intFromEnum(enum_or_tagged_union: anytype) anytype{#endsyntax#}</pre>
86948683 <p>
8695 Attempting to convert an integer which represents no value in the chosen enum type invokes
8696 safety-checked {#link|Undefined Behavior#}.
8684 Converts an enumeration value into its integer tag type. When a tagged union is passed,
8685 the tag value is used as the enumeration value.
86978686 </p>
8698 {#see_also|@intFromEnum#}
8687 <p>
8688 If there is only one possible enum value, the result is a {#syntax#}comptime_int{#endsyntax#}
8689 known at {#link|comptime#}.
8690 </p>
8691 {#see_also|@enumFromInt#}
86998692 {#header_close#}
87008693
8701 {#header_open|@errorFromInt#}
8702 <pre>{#syntax#}@errorFromInt(value: std.meta.Int(.unsigned, @sizeOf(anyerror) * 8)) anyerror{#endsyntax#}</pre>
8694 {#header_open|@intFromError#}
8695 <pre>{#syntax#}@intFromError(err: anytype) std.meta.Int(.unsigned, @sizeOf(anyerror) * 8){#endsyntax#}</pre>
87038696 <p>
8704 Converts from the integer representation of an error into {#link|The Global Error Set#} type.
8697 Supports the following types:
87058698 </p>
8699 <ul>
8700 <li>{#link|The Global Error Set#}</li>
8701 <li>{#link|Error Set Type#}</li>
8702 <li>{#link|Error Union Type#}</li>
8703 </ul>
87068704 <p>
8707 It is generally recommended to avoid this
8708 cast, as the integer representation of an error is not stable across source code changes.
8705 Converts an error to the integer representation of an error.
87098706 </p>
87108707 <p>
8711 Attempting to convert an integer that does not correspond to any error results in
8712 safety-protected {#link|Undefined Behavior#}.
8708 It is generally recommended to avoid this
8709 cast, as the integer representation of an error is not stable across source code changes.
87138710 </p>
8714 {#see_also|@intFromError#}
8711 {#see_also|@errorFromInt#}
87158712 {#header_close#}
87168713
8717 {#header_open|@floatFromInt#}
8718 <pre>{#syntax#}@floatFromInt(int: anytype) anytype{#endsyntax#}</pre>
8714 {#header_open|@intFromFloat#}
8715 <pre>{#syntax#}@intFromFloat(float: anytype) anytype{#endsyntax#}</pre>
87198716 <p>
8720 Converts an integer to the closest floating point representation. The return type is the inferred result type.
8721 To convert the other way, use {#link|@intFromFloat#}. This cast is always safe.
8717 Converts the integer part of a floating point number to the inferred result type.
87228718 </p>
8723 {#header_close#}
8724
8725 {#header_open|@ptrFromInt#}
8726 <pre>{#syntax#}@ptrFromInt(address: usize) anytype{#endsyntax#}</pre>
87278719 <p>
8728 Converts an integer to a {#link|pointer|Pointers#}. The return type is the inferred result type.
8729 To convert the other way, use {#link|@intFromPtr#}. Casting an address of 0 to a destination type
8730 which in not {#link|optional|Optional Pointers#} and does not have the {#syntax#}allowzero{#endsyntax#} attribute will result in a
8731 {#link|Pointer Cast Invalid Null#} panic when runtime safety checks are enabled.
8720 If the integer part of the floating point number cannot fit in the destination type,
8721 it invokes safety-checked {#link|Undefined Behavior#}.
87328722 </p>
8723 {#see_also|@floatFromInt#}
8724 {#header_close#}
8725
8726 {#header_open|@intFromPtr#}
8727 <pre>{#syntax#}@intFromPtr(value: anytype) usize{#endsyntax#}</pre>
87338728 <p>
8734 If the destination pointer type does not allow address zero and {#syntax#}address{#endsyntax#}
8735 is zero, this invokes safety-checked {#link|Undefined Behavior#}.
8729 Converts {#syntax#}value{#endsyntax#} to a {#syntax#}usize{#endsyntax#} which is the address of the pointer.
8730 {#syntax#}value{#endsyntax#} can be {#syntax#}*T{#endsyntax#} or {#syntax#}?*T{#endsyntax#}.
87368731 </p>
8732 <p>To convert the other way, use {#link|@ptrFromInt#}</p>
87378733 {#header_close#}
87388734
87398735 {#header_open|@max#}
......@@ -8950,14 +8946,18 @@ pub const PrefetchOptions = struct {
89508946 </ul>
89518947 {#header_close#}
89528948
8953 {#header_open|@intFromPtr#}
8954 <pre>{#syntax#}@intFromPtr(value: anytype) usize{#endsyntax#}</pre>
8949 {#header_open|@ptrFromInt#}
8950 <pre>{#syntax#}@ptrFromInt(address: usize) anytype{#endsyntax#}</pre>
89558951 <p>
8956 Converts {#syntax#}value{#endsyntax#} to a {#syntax#}usize{#endsyntax#} which is the address of the pointer.
8957 {#syntax#}value{#endsyntax#} can be {#syntax#}*T{#endsyntax#} or {#syntax#}?*T{#endsyntax#}.
8952 Converts an integer to a {#link|pointer|Pointers#}. The return type is the inferred result type.
8953 To convert the other way, use {#link|@intFromPtr#}. Casting an address of 0 to a destination type
8954 which in not {#link|optional|Optional Pointers#} and does not have the {#syntax#}allowzero{#endsyntax#} attribute will result in a
8955 {#link|Pointer Cast Invalid Null#} panic when runtime safety checks are enabled.
8956 </p>
8957 <p>
8958 If the destination pointer type does not allow address zero and {#syntax#}address{#endsyntax#}
8959 is zero, this invokes safety-checked {#link|Undefined Behavior#}.
89588960 </p>
8959 <p>To convert the other way, use {#link|@ptrFromInt#}</p>
8960
89618961 {#header_close#}
89628962
89638963 {#header_open|@rem#}