| ... | @@ -1850,8 +1850,8 @@ test "null terminated array" { | ... | @@ -1850,8 +1850,8 @@ test "null terminated array" { |
| 1850 | {#header_open|Vectors#} | 1850 | {#header_open|Vectors#} |
| 1851 | <p> | 1851 | <p> |
| 1852 | A vector is a group of {#link|Integers#}, {#link|Floats#}, or {#link|Pointers#} which are operated on | 1852 | A vector is a group of {#link|Integers#}, {#link|Floats#}, or {#link|Pointers#} which are operated on |
| 1853 | in parallel using a single instruction ({#link|SIMD#}). Vector types are created with the builtin | 1853 | in parallel using a single instruction ({#link|SIMD#}). Vector types are created with the builtin function {#link|@Type#}, |
| 1854 | function {#link|@Vector#}. | 1854 | or using the shorthand as {#syntax#}std.meta.Vector{#endsyntax#}. |
| 1855 | </p> | 1855 | </p> |
| 1856 | <p> | 1856 | <p> |
| 1857 | TODO talk about C ABI interop | 1857 | TODO talk about C ABI interop |
| ... | @@ -7934,7 +7934,7 @@ test "@setRuntimeSafety" { | ... | @@ -7934,7 +7934,7 @@ test "@setRuntimeSafety" { |
| 7934 | {#header_close#} | 7934 | {#header_close#} |
| 7935 | | 7935 | |
| 7936 | {#header_open|@shuffle#} | 7936 | {#header_open|@shuffle#} |
| 7937 | <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> | 7937 | <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> |
| 7938 | <p> | 7938 | <p> |
| 7939 | Constructs a new {#link|vector|Vectors#} by selecting elements from {#syntax#}a{#endsyntax#} and | 7939 | Constructs a new {#link|vector|Vectors#} by selecting elements from {#syntax#}a{#endsyntax#} and |
| 7940 | {#syntax#}b{#endsyntax#} based on {#syntax#}mask{#endsyntax#}. | 7940 | {#syntax#}b{#endsyntax#} based on {#syntax#}mask{#endsyntax#}. |
| ... | @@ -7990,7 +7990,7 @@ test "@setRuntimeSafety" { | ... | @@ -7990,7 +7990,7 @@ test "@setRuntimeSafety" { |
| 7990 | {#header_close#} | 7990 | {#header_close#} |
| 7991 | | 7991 | |
| 7992 | {#header_open|@splat#} | 7992 | {#header_open|@splat#} |
| 7993 | <pre>{#syntax#}@splat(comptime len: u32, scalar: var) @Vector(len, @TypeOf(scalar)){#endsyntax#}</pre> | 7993 | <pre>{#syntax#}@splat(comptime len: u32, scalar: var) std.meta.Vector(len, @TypeOf(scalar)){#endsyntax#}</pre> |
| 7994 | <p> | 7994 | <p> |
| 7995 | Produces a vector of length {#syntax#}len{#endsyntax#} where each element is the value | 7995 | Produces a vector of length {#syntax#}len{#endsyntax#} where each element is the value |
| 7996 | {#syntax#}scalar{#endsyntax#}: | 7996 | {#syntax#}scalar{#endsyntax#}: |
| ... | @@ -8002,7 +8002,7 @@ const assert = std.debug.assert; | ... | @@ -8002,7 +8002,7 @@ const assert = std.debug.assert; |
| 8002 | test "vector @splat" { | 8002 | test "vector @splat" { |
| 8003 | const scalar: u32 = 5; | 8003 | const scalar: u32 = 5; |
| 8004 | const result = @splat(4, scalar); | 8004 | const result = @splat(4, scalar); |
| 8005 | comptime assert(@TypeOf(result) == @Vector(4, u32)); | 8005 | comptime assert(@TypeOf(result) == std.meta.Vector(4, u32)); |
| 8006 | assert(std.mem.eql(u32, &@as([4]u32, result), &[_]u32{ 5, 5, 5, 5 })); | 8006 | assert(std.mem.eql(u32, &@as([4]u32, result), &[_]u32{ 5, 5, 5, 5 })); |
| 8007 | } | 8007 | } |
| 8008 | {#code_end#} | 8008 | {#code_end#} |
| ... | @@ -8360,17 +8360,6 @@ fn foo(comptime T: type, ptr: *T) T { | ... | @@ -8360,17 +8360,6 @@ fn foo(comptime T: type, ptr: *T) T { |
| 8360 | {#syntax#}@unionInit{#endsyntax#} forwards its {#link|result location|Result Location Semantics#} to {#syntax#}init_expr{#endsyntax#}. | 8360 | {#syntax#}@unionInit{#endsyntax#} forwards its {#link|result location|Result Location Semantics#} to {#syntax#}init_expr{#endsyntax#}. |
| 8361 | </p> | 8361 | </p> |
| 8362 | {#header_close#} | 8362 | {#header_close#} |
| 8363 | | | |
| 8364 | {#header_open|@Vector#} | | |
| 8365 | <pre>{#syntax#}@Vector(comptime len: u32, comptime ElemType: type) type{#endsyntax#}</pre> | | |
| 8366 | <p> | | |
| 8367 | This function returns a vector type for {#link|SIMD#}. | | |
| 8368 | </p> | | |
| 8369 | <p> | | |
| 8370 | {#syntax#}ElemType{#endsyntax#} must be an {#link|integer|Integers#}, a {#link|float|Floats#}, or a | | |
| 8371 | {#link|pointer|Pointers#}. | | |
| 8372 | </p> | | |
| 8373 | {#header_close#} | | |
| 8374 | {#header_close#} | 8363 | {#header_close#} |
| 8375 | | 8364 | |
| 8376 | {#header_open|Build Mode#} | 8365 | {#header_open|Build Mode#} |