///|
fn[T] ref_add(ref_ : Ref[T], offset : UInt64) -> Ref[T] = "%u64.add"

///|
pub fn[T] size_in_ref(_ : FuncRef[(T) -> Unit]) -> @c.Size {
  let base_ref : Ref[T] = @pointer.unsafe_into(@c.Pointer::null())
  let next_ref : Ref[T] = ref_add(base_ref, 1)
  let next_ptr : @c.Pointer[Unit] = @c.Pointer::unsafe_from(next_ref)
  next_ptr.to_uint64()
}

///|
fn[T] array_add(array : FixedArray[T], offset : UInt64) -> FixedArray[T] = "%u64.add"

///|
pub fn[T] size_in_array(_ : FuncRef[(T) -> Unit]) -> @c.Size {
  let base_array : FixedArray[T] = @pointer.unsafe_into(@c.Pointer::null())
  let next_array : FixedArray[T] = array_add(base_array, 1)
  let next_ptr : @c.Pointer[Unit] = @c.Pointer::unsafe_from(next_array)
  next_ptr.to_uint64()
}