Compare commits

..

2 Commits

2 changed files with 12 additions and 8 deletions

View File

@ -179,7 +179,10 @@ 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)
}
@ -203,8 +206,10 @@ 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())
}

View File

@ -112,11 +112,10 @@ 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.