aboutsummaryrefslogtreecommitdiff
path: root/Math_Ext.jai
diff options
context:
space:
mode:
Diffstat (limited to 'Math_Ext.jai')
-rw-r--r--Math_Ext.jai84
1 files changed, 42 insertions, 42 deletions
diff --git a/Math_Ext.jai b/Math_Ext.jai
index d42b1bd..3c46c4e 100644
--- a/Math_Ext.jai
+++ b/Math_Ext.jai
@@ -72,7 +72,7 @@ add :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, saturated: b
saturated: bool = ---;
- S_ADD_ASM :: #string DONE
+ ADD_SIGNED_ASM :: #string DONE
#asm {
mov result, -1; // Pre-set result with signed maximum (set all ones...
shr.SIZE result, 1; // ...then, insert zero on MSB).
@@ -86,16 +86,16 @@ add :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, saturated: b
DONE
#if Tr == s8
- #insert #run replace(replace(S_ADD_ASM, ".SIZE", ".b"), "SIGN_BIT", "7");
+ #insert #run replace(replace(ADD_SIGNED_ASM, ".SIZE", ".b"), "SIGN_BIT", "7");
#if Tr == s16
- #insert #run replace(replace(S_ADD_ASM, ".SIZE", ".w"), "SIGN_BIT", "15");
+ #insert #run replace(replace(ADD_SIGNED_ASM, ".SIZE", ".w"), "SIGN_BIT", "15");
#if Tr == s32
- #insert #run replace(replace(S_ADD_ASM, ".SIZE", ".d"), "SIGN_BIT", "31");
+ #insert #run replace(replace(ADD_SIGNED_ASM, ".SIZE", ".d"), "SIGN_BIT", "31");
#if Tr == s64
- #insert #run replace(replace(S_ADD_ASM, ".SIZE", ".q"), "SIGN_BIT", "63");
+ #insert #run replace(replace(ADD_SIGNED_ASM, ".SIZE", ".q"), "SIGN_BIT", "63");
- U_ADD_ASM :: #string DONE
+ ADD_UNSIGNED_ASM :: #string DONE
#asm {
mov result, -1; // Pre-set result with unsigned maximum.
add.SIZE x, y; // Add values (affect CF).
@@ -105,13 +105,13 @@ add :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, saturated: b
DONE
#if Tr == u8
- #insert #run replace(U_ADD_ASM, ".SIZE", ".b");
+ #insert #run replace(ADD_UNSIGNED_ASM, ".SIZE", ".b");
#if Tr == u16
- #insert #run replace(U_ADD_ASM, ".SIZE", ".w");
+ #insert #run replace(ADD_UNSIGNED_ASM, ".SIZE", ".w");
#if Tr == u32
- #insert #run replace(U_ADD_ASM, ".SIZE", ".d");
+ #insert #run replace(ADD_UNSIGNED_ASM, ".SIZE", ".d");
#if Tr == u64
- #insert #run replace(U_ADD_ASM, ".SIZE", ".q");
+ #insert #run replace(ADD_UNSIGNED_ASM, ".SIZE", ".q");
return result, saturated;
@@ -149,7 +149,7 @@ sub :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, overflow: bo
saturated: bool = ---;
- S_SUB_ASM :: #string DONE
+ SUB_SIGNED_ASM :: #string DONE
#asm {
mov result, -1; // Pre-set result with signed maximum (set all ones...
shr.SIZE result, 1; // ...then, insert zero on MSB).
@@ -163,16 +163,16 @@ sub :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, overflow: bo
DONE
#if Tr == s8
- #insert #run replace(replace(S_SUB_ASM, ".SIZE", ".b"), "SIGN_BIT", "7");
+ #insert #run replace(replace(SUB_SIGNED_ASM, ".SIZE", ".b"), "SIGN_BIT", "7");
#if Tr == s16
- #insert #run replace(replace(S_SUB_ASM, ".SIZE", ".w"), "SIGN_BIT", "15");
+ #insert #run replace(replace(SUB_SIGNED_ASM, ".SIZE", ".w"), "SIGN_BIT", "15");
#if Tr == s32
- #insert #run replace(replace(S_SUB_ASM, ".SIZE", ".d"), "SIGN_BIT", "31");
+ #insert #run replace(replace(SUB_SIGNED_ASM, ".SIZE", ".d"), "SIGN_BIT", "31");
#if Tr == s64
- #insert #run replace(replace(S_SUB_ASM, ".SIZE", ".q"), "SIGN_BIT", "63");
+ #insert #run replace(replace(SUB_SIGNED_ASM, ".SIZE", ".q"), "SIGN_BIT", "63");
- U_SUB_ASM :: #string DONE
+ SUB_UNSIGNED_ASM :: #string DONE
#asm {
mov result, 0; // Pre-set result with usigned minimum.
sub.SIZE x, y; // Subtract values (affect CF).
@@ -182,13 +182,13 @@ sub :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, overflow: bo
DONE
#if Tr == u8
- #insert #run replace(U_SUB_ASM, ".SIZE", ".b");
+ #insert #run replace(SUB_UNSIGNED_ASM, ".SIZE", ".b");
#if Tr == u16
- #insert #run replace(U_SUB_ASM, ".SIZE", ".w");
+ #insert #run replace(SUB_UNSIGNED_ASM, ".SIZE", ".w");
#if Tr == u32
- #insert #run replace(U_SUB_ASM, ".SIZE", ".d");
+ #insert #run replace(SUB_UNSIGNED_ASM, ".SIZE", ".d");
#if Tr == u64
- #insert #run replace(U_SUB_ASM, ".SIZE", ".q");
+ #insert #run replace(SUB_UNSIGNED_ASM, ".SIZE", ".q");
return result, saturated;
@@ -234,7 +234,7 @@ mul :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, overflow: bo
result: Tr = ---;
saturated: bool = ---;
- S_MUL_ASM :: #string DONE
+ MUL_SIGNED_ASM :: #string DONE
#asm {
mov x_: gpr === a, x; // Pin copy of x value to register A (don't know why... but seems faster this way).
@@ -252,16 +252,16 @@ mul :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, overflow: bo
DONE
#if Tr == s8
- #insert #run replace(replace(S_MUL_ASM, ".SIZE", ".b"), "SIGN_BIT", "7");
+ #insert #run replace(replace(MUL_SIGNED_ASM, ".SIZE", ".b"), "SIGN_BIT", "7");
#if Tr == s16
- #insert #run replace(replace(S_MUL_ASM, ".SIZE", ".w"), "SIGN_BIT", "15");
+ #insert #run replace(replace(MUL_SIGNED_ASM, ".SIZE", ".w"), "SIGN_BIT", "15");
#if Tr == s32
- #insert #run replace(replace(S_MUL_ASM, ".SIZE", ".d"), "SIGN_BIT", "31");
+ #insert #run replace(replace(MUL_SIGNED_ASM, ".SIZE", ".d"), "SIGN_BIT", "31");
#if Tr == s64
- #insert #run replace(replace(S_MUL_ASM, ".SIZE", ".q"), "SIGN_BIT", "63");
+ #insert #run replace(replace(MUL_SIGNED_ASM, ".SIZE", ".q"), "SIGN_BIT", "63");
- U_MUL_ASM :: #string DONE
+ MUL_UNSIGNED_ASM :: #string DONE
#asm {
result === a; // Pin result to register A.
@@ -274,13 +274,13 @@ mul :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, overflow: bo
DONE
#if Tr == u8
- #insert #run replace(replace(U_MUL_ASM, ".SIZE", ".b"), "reg_d:,", ""); // For 8bits mul, we do not need D register.
+ #insert #run replace(replace(MUL_UNSIGNED_ASM, ".SIZE", ".b"), "reg_d:,", ""); // For 8bits mul, we do not need D register.
#if Tr == u16
- #insert #run replace(U_MUL_ASM, ".SIZE", ".w");
+ #insert #run replace(MUL_UNSIGNED_ASM, ".SIZE", ".w");
#if Tr == u32
- #insert #run replace(U_MUL_ASM, ".SIZE", ".d");
+ #insert #run replace(MUL_UNSIGNED_ASM, ".SIZE", ".d");
#if Tr == u64
- #insert #run replace(U_MUL_ASM, ".SIZE", ".q");
+ #insert #run replace(MUL_UNSIGNED_ASM, ".SIZE", ".q");
return result, saturated;
@@ -315,7 +315,7 @@ div :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, remainder: T
remainder: Tr = ---;
saturated: bool = ---;
- S_DIV_ASM :: #string DONE
+ DIV_SIGNED_ASM :: #string DONE
#asm {
result === a;
remainder === d;
@@ -341,7 +341,7 @@ div :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, remainder: T
}
DONE
- S_DIV_ASM_8BITS :: #string DONE
+ DIV_SIGNED_ASM_8BITS :: #string DONE
#asm {
result === a;
@@ -373,16 +373,16 @@ div :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, remainder: T
DONE
#if Tr == s8
- #insert #run replace(replace(replace(S_DIV_ASM_8BITS, ".SIZE", ".b"), "MIN", "-128"), "LIMIT", "-127");
+ #insert #run replace(replace(replace(DIV_SIGNED_ASM_8BITS, ".SIZE", ".b"), "MIN", "-128"), "LIMIT", "-127");
#if Tr == s16
- #insert #run replace(replace(replace(replace(S_DIV_ASM, ".SIZE", ".w"), "MIN", "-32768"), "LIMIT", "-32767"), "SIGN_EXT", "cwd");
+ #insert #run replace(replace(replace(replace(DIV_SIGNED_ASM, ".SIZE", ".w"), "MIN", "-32768"), "LIMIT", "-32767"), "SIGN_EXT", "cwd");
#if Tr == s32
- #insert #run replace(replace(replace(replace(S_DIV_ASM, ".SIZE", ".d"), "MIN", "-2147483648"), "LIMIT", "-2147483647"), "SIGN_EXT", "cdq");
+ #insert #run replace(replace(replace(replace(DIV_SIGNED_ASM, ".SIZE", ".d"), "MIN", "-2147483648"), "LIMIT", "-2147483647"), "SIGN_EXT", "cdq");
#if Tr == s64
- #insert #run replace(replace(replace(replace(S_DIV_ASM, ".SIZE", ".q"), "MIN", "-9223372036854775808"), "LIMIT", "-9223372036854775807"), "SIGN_EXT", "cqo");
+ #insert #run replace(replace(replace(replace(DIV_SIGNED_ASM, ".SIZE", ".q"), "MIN", "-9223372036854775808"), "LIMIT", "-9223372036854775807"), "SIGN_EXT", "cqo");
- U_DIV_ASM :: #string DONE
+ DIV_UNSIGNED_ASM :: #string DONE
#asm {
result === a;
remainder === d;
@@ -394,7 +394,7 @@ div :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, remainder: T
}
DONE
- U_DIV_ASM_8BITS :: #string DONE
+ DIV_UNSIGNED_ASM_8BITS :: #string DONE
#asm {
result === a;
remainder === d;
@@ -410,13 +410,13 @@ div :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, remainder: T
DONE
#if Tr == u8
- #insert #run replace(U_DIV_ASM_8BITS, ".SIZE", ".b");
+ #insert #run replace(DIV_UNSIGNED_ASM_8BITS, ".SIZE", ".b");
#if Tr == u16
- #insert #run replace(U_DIV_ASM, ".SIZE", ".w");
+ #insert #run replace(DIV_UNSIGNED_ASM, ".SIZE", ".w");
#if Tr == u32
- #insert #run replace(U_DIV_ASM, ".SIZE", ".d");
+ #insert #run replace(DIV_UNSIGNED_ASM, ".SIZE", ".d");
#if Tr == u64
- #insert #run replace(U_DIV_ASM, ".SIZE", ".q");
+ #insert #run replace(DIV_UNSIGNED_ASM, ".SIZE", ".q");
return result, remainder, saturated;