tiny.simd.bitShuffle
Defined in table.
Source
Source: lib/simd/src/table.zig:11
zig
pub fn bitShuffle(comptime D: type, values: D.Vector, indices: anytype) D.Vector { if (D.Lane != u64 and D.Lane != i64) @compileError("bitShuffle requires 64-bit integer lanes"); const index_info = vectorInfo(@TypeOf(indices)); if (@typeInfo(index_info.child) != .int or @bitSizeOf(index_info.child) != 8) { @compileError("bitShuffle indices require 8-bit integer lanes"); } if (index_info.len != D.lane_count * 8) @compileError("bitShuffle requires eight indices per lane"); const value_lanes: [D.lane_count]D.Lane = @bitCast(values); const index_lanes: [index_info.len]index_info.child = @bitCast(indices); var result: [D.lane_count]u64 = @splat(0); inline for (0..D.lane_count) |lane| { const bits: u64 = @bitCast(value_lanes[lane]); inline for (0..8) |bit| { const index = checkedIndex(index_lanes[lane * 8 + bit]); std.debug.assert(index < 64); result[lane] |= ((bits >> @intCast(index)) & 1) << bit; } } return @bitCast(result);}Source: lib/simd/src/root.zig:874
zig
pub const bitShuffle = table.bitShuffle;Audit
| Definitions | 1 |
|---|---|
| Public names | 2 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |