mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-19 01:41:30 +00:00
Update internal ABI to zero/sign-extend where necessary only (#87)
This commit is contained in:
6
src/glue/js/i64.d.ts
vendored
6
src/glue/js/i64.d.ts
vendored
@ -2,6 +2,9 @@
|
||||
|
||||
declare type I64 = { __Long__: true }; // opaque
|
||||
|
||||
declare const i64_zero: I64;
|
||||
declare const i64_one: I64;
|
||||
|
||||
declare function i64_new(lo: i32, hi?: i32): I64;
|
||||
declare function i64_low(value: I64): i32;
|
||||
declare function i64_high(value: I64): i32;
|
||||
@ -21,6 +24,9 @@ declare function i64_shr(left: I64, right: I64): I64;
|
||||
declare function i64_shr_u(left: I64, right: I64): I64;
|
||||
declare function i64_not(value: I64): I64;
|
||||
|
||||
declare function i64_eq(left: I64, right: I64): bool;
|
||||
declare function i64_ne(left: I64, right: I64): bool;
|
||||
|
||||
declare function i64_align(value: I64, alignment: i32): I64;
|
||||
|
||||
declare function i64_is_i8(value: I64): bool;
|
||||
|
@ -1,5 +1,9 @@
|
||||
const Long = global.Long || require("long");
|
||||
|
||||
global.i64_zero = Long.ZERO;
|
||||
|
||||
global.i64_one = Long.ONE;
|
||||
|
||||
global.i64_new = function(lo, hi) {
|
||||
return Long.fromBits(lo, hi);
|
||||
};
|
||||
@ -68,6 +72,14 @@ global.i64_not = function(value) {
|
||||
return value.not();
|
||||
};
|
||||
|
||||
global.i64_eq = function(left, right) {
|
||||
return left.eq(right);
|
||||
};
|
||||
|
||||
global.i64_ne = function(left, right) {
|
||||
return left.ne(right);
|
||||
};
|
||||
|
||||
global.i64_align = function(value, alignment) {
|
||||
assert(alignment && (alignment & (alignment - 1)) == 0);
|
||||
var mask = Long.fromInt(alignment - 1);
|
||||
|
@ -2,6 +2,12 @@
|
||||
|
||||
type I64 = i64;
|
||||
|
||||
@global
|
||||
const i64_zero: I64 = 0;
|
||||
|
||||
@global
|
||||
const i64_one: I64 = 1;
|
||||
|
||||
@global
|
||||
function i64_new(lo: i32, hi: i32 = 0): I64 {
|
||||
return lo | (hi << 32);
|
||||
@ -87,6 +93,16 @@ function i64_not(value: I64): I64 {
|
||||
return ~value;
|
||||
}
|
||||
|
||||
@global
|
||||
function i64_eq(left: I64, right: I64): bool {
|
||||
return left == right;
|
||||
}
|
||||
|
||||
@global
|
||||
function i64_ne(left: I64, right: I64): bool {
|
||||
return left != right;
|
||||
}
|
||||
|
||||
@global
|
||||
function i64_align(value: I64, alignment: i64): I64 {
|
||||
var mask: i64 = alignment - 1;
|
||||
|
Reference in New Issue
Block a user