Update language reference for std.meta.Vector

master
Tadeo Kondrak 2020-04-27 23:46:49 -06:00
parent f977155fdb
commit 0673a8d576
No known key found for this signature in database
GPG Key ID: D41E092CA43F1D8B
1 changed files with 5 additions and 16 deletions

View File

@ -1850,8 +1850,8 @@ test "null terminated array" {
{#header_open|Vectors#} {#header_open|Vectors#}
<p> <p>
A vector is a group of {#link|Integers#}, {#link|Floats#}, or {#link|Pointers#} which are operated on A vector is a group of {#link|Integers#}, {#link|Floats#}, or {#link|Pointers#} which are operated on
in parallel using a single instruction ({#link|SIMD#}). Vector types are created with the builtin in parallel using a single instruction ({#link|SIMD#}). Vector types are created with the builtin function {#link|@Type#},
function {#link|@Vector#}. or using the shorthand as {#syntax#}std.meta.Vector{#endsyntax#}.
</p> </p>
<p> <p>
TODO talk about C ABI interop TODO talk about C ABI interop
@ -7934,7 +7934,7 @@ test "@setRuntimeSafety" {
{#header_close#} {#header_close#}
{#header_open|@shuffle#} {#header_open|@shuffle#}
<pre>{#syntax#}@shuffle(comptime E: type, a: @Vector(a_len, E), b: @Vector(b_len, E), comptime mask: @Vector(mask_len, i32)) @Vector(mask_len, E){#endsyntax#}</pre> <pre>{#syntax#}@shuffle(comptime E: type, a: std.meta.Vector(a_len, E), b: std.meta.Vector(b_len, E), comptime mask: std.meta.Vector(mask_len, i32)) std.meta.Vector(mask_len, E){#endsyntax#}</pre>
<p> <p>
Constructs a new {#link|vector|Vectors#} by selecting elements from {#syntax#}a{#endsyntax#} and Constructs a new {#link|vector|Vectors#} by selecting elements from {#syntax#}a{#endsyntax#} and
{#syntax#}b{#endsyntax#} based on {#syntax#}mask{#endsyntax#}. {#syntax#}b{#endsyntax#} based on {#syntax#}mask{#endsyntax#}.
@ -7990,7 +7990,7 @@ test "@setRuntimeSafety" {
{#header_close#} {#header_close#}
{#header_open|@splat#} {#header_open|@splat#}
<pre>{#syntax#}@splat(comptime len: u32, scalar: var) @Vector(len, @TypeOf(scalar)){#endsyntax#}</pre> <pre>{#syntax#}@splat(comptime len: u32, scalar: var) std.meta.Vector(len, @TypeOf(scalar)){#endsyntax#}</pre>
<p> <p>
Produces a vector of length {#syntax#}len{#endsyntax#} where each element is the value Produces a vector of length {#syntax#}len{#endsyntax#} where each element is the value
{#syntax#}scalar{#endsyntax#}: {#syntax#}scalar{#endsyntax#}:
@ -8002,7 +8002,7 @@ const assert = std.debug.assert;
test "vector @splat" { test "vector @splat" {
const scalar: u32 = 5; const scalar: u32 = 5;
const result = @splat(4, scalar); const result = @splat(4, scalar);
comptime assert(@TypeOf(result) == @Vector(4, u32)); comptime assert(@TypeOf(result) == std.meta.Vector(4, u32));
assert(std.mem.eql(u32, &@as([4]u32, result), &[_]u32{ 5, 5, 5, 5 })); assert(std.mem.eql(u32, &@as([4]u32, result), &[_]u32{ 5, 5, 5, 5 }));
} }
{#code_end#} {#code_end#}
@ -8360,17 +8360,6 @@ fn foo(comptime T: type, ptr: *T) T {
{#syntax#}@unionInit{#endsyntax#} forwards its {#link|result location|Result Location Semantics#} to {#syntax#}init_expr{#endsyntax#}. {#syntax#}@unionInit{#endsyntax#} forwards its {#link|result location|Result Location Semantics#} to {#syntax#}init_expr{#endsyntax#}.
</p> </p>
{#header_close#} {#header_close#}
{#header_open|@Vector#}
<pre>{#syntax#}@Vector(comptime len: u32, comptime ElemType: type) type{#endsyntax#}</pre>
<p>
This function returns a vector type for {#link|SIMD#}.
</p>
<p>
{#syntax#}ElemType{#endsyntax#} must be an {#link|integer|Integers#}, a {#link|float|Floats#}, or a
{#link|pointer|Pointers#}.
</p>
{#header_close#}
{#header_close#} {#header_close#}
{#header_open|Build Mode#} {#header_open|Build Mode#}