Model::{sizeof -> size_of}
This commit is contained in:
parent
dbcfc9538a
commit
7c7e1b3ab8
|
@ -71,7 +71,7 @@ pub trait Model<'ctx>: fmt::Debug + Clone + Copy {
|
||||||
fn get_type<G: CodeGenerator + ?Sized>(&self, generator: &G, ctx: &'ctx Context) -> Self::Type;
|
fn get_type<G: CodeGenerator + ?Sized>(&self, generator: &G, ctx: &'ctx Context) -> Self::Type;
|
||||||
|
|
||||||
/// Get the number of bytes of the [`BasicType`] of this model.
|
/// Get the number of bytes of the [`BasicType`] of this model.
|
||||||
fn sizeof<G: CodeGenerator + ?Sized>(
|
fn size_of<G: CodeGenerator + ?Sized>(
|
||||||
&self,
|
&self,
|
||||||
generator: &mut G,
|
generator: &mut G,
|
||||||
ctx: &'ctx Context,
|
ctx: &'ctx Context,
|
||||||
|
|
|
@ -199,7 +199,7 @@ impl<'ctx, Item: Model<'ctx>> Instance<'ctx, Ptr<Item>> {
|
||||||
num_items: IntValue<'ctx>,
|
num_items: IntValue<'ctx>,
|
||||||
) {
|
) {
|
||||||
// Force extend `num_items` and `itemsize` to `i64` so their types would match.
|
// Force extend `num_items` and `itemsize` to `i64` so their types would match.
|
||||||
let itemsize = self.model.sizeof(generator, ctx.ctx);
|
let itemsize = self.model.size_of(generator, ctx.ctx);
|
||||||
let itemsize = Int(Int64).z_extend_or_truncate(generator, ctx, itemsize);
|
let itemsize = Int(Int64).z_extend_or_truncate(generator, ctx, itemsize);
|
||||||
let num_items = Int(Int64).z_extend_or_truncate(generator, ctx, num_items);
|
let num_items = Int(Int64).z_extend_or_truncate(generator, ctx, num_items);
|
||||||
let totalsize = itemsize.mul(ctx, num_items);
|
let totalsize = itemsize.mul(ctx, num_items);
|
||||||
|
|
Loading…
Reference in New Issue