Compare commits
2 Commits
0cca9dcfc4
...
2b3e26c421
Author | SHA1 | Date |
---|---|---|
David Mak | 2b3e26c421 | |
David Mak | ebe1b5b85f |
|
@ -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())
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue