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#}
<p>
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
function {#link|@Vector#}.
in parallel using a single instruction ({#link|SIMD#}). Vector types are created with the builtin function {#link|@Type#},
or using the shorthand as {#syntax#}std.meta.Vector{#endsyntax#}.
</p>
<p>
TODO talk about C ABI interop
@ -7934,7 +7934,7 @@ test "@setRuntimeSafety" {
{#header_close#}
{#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>
Constructs a new {#link|vector|Vectors#} by selecting elements from {#syntax#}a{#endsyntax#} and
{#syntax#}b{#endsyntax#} based on {#syntax#}mask{#endsyntax#}.
@ -7990,7 +7990,7 @@ test "@setRuntimeSafety" {
{#header_close#}
{#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>
Produces a vector of length {#syntax#}len{#endsyntax#} where each element is the value
{#syntax#}scalar{#endsyntax#}:
@ -8002,7 +8002,7 @@ const assert = std.debug.assert;
test "vector @splat" {
const scalar: u32 = 5;
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 }));
}
{#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#}.
</p>
{#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_open|Build Mode#}