tiny.simd.AlignedView
Defined in aligned.
Source
Source: lib/simd/src/aligned.zig:301
zig
pub fn View(comptime T: type, comptime axes: usize) type { return struct { layout: Layout(axes), storage: []T, const Self = @This(); pub fn init(storage: []T, shape_value: [axes]usize) Error!Self { return initFor(storage, shape_value, native_vector_bytes); } pub fn initFor( storage: []T, shape_value: [axes]usize, vector_bytes: usize, ) Error!Self { if (!isAligned(storage.ptr)) return error.MisalignedStorage; const layout = try Layout(axes).initFor(shape_value, vector_bytes); if (storage.len < layout.memoryLen()) return error.StorageTooSmall; return .{ .layout = layout, .storage = storage[0..layout.memoryLen()], }; } pub fn row(self: *Self, indices: [axes - 1]usize) Error![]T { const offset = try self.layout.rowOffset(indices); return self.storage[offset..][0..self.layout.rowLen()]; } pub fn constRow( self: *const Self, indices: [axes - 1]usize, ) Error![]const T { const offset = try self.layout.rowOffset(indices); return self.storage[offset..][0..self.layout.rowLen()]; } pub fn truncate(self: *Self, new_shape: [axes]usize) Error!void { try self.layout.truncate(new_shape); } };}Source: lib/simd/src/root.zig:252
zig
pub const AlignedView = aligned.View;Audit
| Definitions | 1 |
|---|---|
| Public names | 2 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |