Compare commits
2 Commits
2b3e26c421
...
0cca9dcfc4
Author | SHA1 | Date |
---|---|---|
David Mak | 0cca9dcfc4 | |
David Mak | b8b34e0b2f |
|
@ -179,10 +179,7 @@ impl<'ctx> NDArrayType<'ctx> {
|
|||
|
||||
// TODO: Move this into e.g. StructProxyType
|
||||
#[must_use]
|
||||
fn fields(
|
||||
ctx: &'ctx Context,
|
||||
llvm_usize: IntType<'ctx>,
|
||||
) -> NDArrayStructFields<'ctx> {
|
||||
fn fields(ctx: &'ctx Context, llvm_usize: IntType<'ctx>) -> NDArrayStructFields<'ctx> {
|
||||
NDArrayStructFields::new(ctx, llvm_usize)
|
||||
}
|
||||
|
||||
|
@ -206,10 +203,8 @@ impl<'ctx> NDArrayType<'ctx> {
|
|||
// * ndims : Number of dimensions in the array
|
||||
// * shape : Pointer to an array containing the shape of the NDArray
|
||||
// * strides : Pointer to an array indicating the number of bytes between each element at a dimension
|
||||
let field_tys = Self::fields(ctx, llvm_usize)
|
||||
.into_iter()
|
||||
.map(|field| field.1)
|
||||
.collect_vec();
|
||||
let field_tys =
|
||||
Self::fields(ctx, llvm_usize).into_iter().map(|field| field.1).collect_vec();
|
||||
|
||||
ctx.struct_type(&field_tys, false).ptr_type(AddressSpace::default())
|
||||
}
|
||||
|
|
|
@ -112,10 +112,11 @@ impl<'ctx> NDArrayValue<'ctx> {
|
|||
|
||||
/// Returns the pointer to the field storing the number of dimensions of this `NDArray`.
|
||||
fn ptr_to_ndims(&self, ctx: &CodeGenContext<'ctx, '_>) -> PointerValue<'ctx> {
|
||||
self.get_type()
|
||||
.get_fields(ctx.ctx, self.llvm_usize)
|
||||
.ndims
|
||||
.ptr_by_gep(ctx, self.as_base_value(), self.name)
|
||||
self.get_type().get_fields(ctx.ctx, self.llvm_usize).ndims.ptr_by_gep(
|
||||
ctx,
|
||||
self.as_base_value(),
|
||||
self.name,
|
||||
)
|
||||
}
|
||||
|
||||
/// Stores the number of dimensions `ndims` into this instance.
|
||||
|
|
Loading…
Reference in New Issue