chore: refactor out i64

main
Sean McBride 4 years ago
parent 4cb7c355b4
commit ec3b489b21

@ -94,15 +94,15 @@ u64_rem(uint64_t a, uint64_t b)
return a % b;
}
INLINE i64
i64_div(i64 a, i64 b)
INLINE int64_t
i64_div(int64_t a, int64_t b)
{
assert(b && (a != INT64_MIN || b != -1));
return a / b;
}
INLINE i64
i64_rem(i64 a, i64 b)
INLINE int64_t
i64_rem(int64_t a, int64_t b)
{
assert(b && (a != INT64_MIN || b != -1));
return a % b;
@ -146,11 +146,11 @@ u64_trunc_f32(float f)
return (uint64_t)f;
}
i64
int64_t
i64_trunc_f32(float f)
{
assert(INT64_MIN <= f && f <= INT64_MAX);
return (i64)f;
return (int64_t)f;
}
uint64_t
@ -160,11 +160,11 @@ u64_trunc_f64(double f)
return (uint64_t)f;
}
i64
int64_t
i64_trunc_f64(double f)
{
assert(INT64_MIN <= f && f <= INT64_MAX);
return (i64)f;
return (int64_t)f;
}
// Float => Float truncation functions

@ -49,13 +49,13 @@ get_i32(i32 offset)
return *(i32 *)address;
}
INLINE i64
INLINE int64_t
get_i64(i32 offset)
{
char *mem_as_chars = (char *)local_sandbox_context_cache.linear_memory_start;
void *address = &mem_as_chars[offset];
return *(i64 *)address;
return *(int64_t *)address;
}
INLINE i32
@ -67,13 +67,13 @@ get_global_i32(i32 offset)
return *(i32 *)address;
}
INLINE i64
INLINE int64_t
get_global_i64(i32 offset)
{
char *mem_as_chars = (char *)local_sandbox_context_cache.linear_memory_start;
void *address = &mem_as_chars[offset];
return *(i64 *)address;
return *(int64_t *)address;
}
// Now setting routines
@ -123,12 +123,12 @@ set_i32(i32 offset, i32 v)
}
INLINE void
set_i64(i32 offset, i64 v)
set_i64(i32 offset, int64_t v)
{
char *mem_as_chars = (char *)local_sandbox_context_cache.linear_memory_start;
void *address = &mem_as_chars[offset];
*(i64 *)address = v;
*(int64_t *)address = v;
}
INLINE void
@ -141,12 +141,12 @@ set_global_i32(i32 offset, i32 v)
}
INLINE void
set_global_i64(i32 offset, i64 v)
set_global_i64(i32 offset, int64_t v)
{
char *mem_as_chars = (char *)local_sandbox_context_cache.linear_memory_start;
void *address = &mem_as_chars[offset];
*(i64 *)address = v;
*(int64_t *)address = v;
}
// Table handling functionality

@ -41,7 +41,6 @@ typedef unsigned char u8;
typedef int16_t i16;
typedef uint16_t u16;
typedef int32_t i32;
typedef int64_t i64;
/* FIXME: per-module configuration? */
#define WASM_PAGE_SIZE (1024 * 64) /* 64KB */

@ -40,10 +40,10 @@ env_a_and_64(i32 p_off, uint64_t v)
}
INLINE void
env_a_or_64(i32 p_off, i64 v)
env_a_or_64(i32 p_off, int64_t v)
{
assert(sizeof(i64) == sizeof(uint64_t));
uint64_t *p = worker_thread_get_memory_ptr_void(p_off, sizeof(i64));
assert(sizeof(int64_t) == sizeof(uint64_t));
uint64_t *p = worker_thread_get_memory_ptr_void(p_off, sizeof(int64_t));
ck_pr_or_64(p, v);
}

@ -249,7 +249,7 @@ wasm_close(i32 file_descriptor)
// What the wasm stat structure looks like
struct wasm_stat {
i64 st_dev;
int64_t st_dev;
uint64_t st_ino;
uint32_t st_nlink;
@ -260,7 +260,7 @@ struct wasm_stat {
uint64_t st_rdev;
uint64_t st_size;
i32 st_blksize;
i64 st_blocks;
int64_t st_blocks;
struct {
i32 tv_sec;

Loading…
Cancel
Save