Add env.small_str_bytes

This commit is contained in:
Richard Feldman 2020-09-12 23:05:01 -04:00
parent 8322006e36
commit 254b93a8ce
2 changed files with 5 additions and 1 deletions

View file

@ -94,6 +94,10 @@ impl<'a, 'ctx, 'env> Env<'a, 'ctx, 'env> {
pub fn ptr_int(&self) -> IntType<'ctx> { pub fn ptr_int(&self) -> IntType<'ctx> {
ptr_int(self.context, self.ptr_bytes) ptr_int(self.context, self.ptr_bytes)
} }
pub fn small_str_bytes(&self) -> u32 {
self.ptr_bytes * 2
}
} }
pub fn module_from_builtins<'ctx>(ctx: &'ctx Context, module_name: &str) -> Module<'ctx> { pub fn module_from_builtins<'ctx>(ctx: &'ctx Context, module_name: &str) -> Module<'ctx> {

View file

@ -401,7 +401,7 @@ where
byte_array_ptr, byte_array_ptr,
&[ctx &[ctx
.i8_type() .i8_type()
.const_int(((env.ptr_bytes * 2) - 1) as u64, false)], .const_int(env.small_str_bytes() as u64 - 1, false)],
"final_byte_ptr", "final_byte_ptr",
) )
}; };