replace float_exponent with macro

This commit is contained in:
Richard Holland
2022-11-07 17:00:41 +00:00
parent ec1fb35ad4
commit 467d8bd3ee
4 changed files with 10 additions and 27 deletions

View File

@@ -251,7 +251,6 @@ namespace hook_api
"etxn_nonce",
"float_compare",
"float_divide",
"float_exponent",
"float_exponent_set",
"float_invert",
"float_mantissa",

View File

@@ -146,7 +146,6 @@ namespace hook_api
DECLARE_HOOK_FUNCTION(int64_t, float_divide, int64_t float1, int64_t float2 );
DECLARE_HOOK_FUNCNARG(int64_t, float_one );
DECLARE_HOOK_FUNCTION(int64_t, float_exponent, int64_t float1 );
DECLARE_HOOK_FUNCTION(int64_t, float_exponent_set, int64_t float1, int32_t exponent );
DECLARE_HOOK_FUNCTION(int64_t, float_mantissa, int64_t float1 );
DECLARE_HOOK_FUNCTION(int64_t, float_mantissa_set, int64_t float1, int64_t mantissa );
@@ -586,14 +585,11 @@ namespace hook
ADD_HOOK_FUNCTION(float_sto, ctx);
ADD_HOOK_FUNCTION(float_sto_set, ctx);
ADD_HOOK_FUNCTION(float_invert, ctx);
ADD_HOOK_FUNCTION(float_mantissa, ctx);
ADD_HOOK_FUNCTION(float_exponent, ctx);
ADD_HOOK_FUNCTION(float_divide, ctx);
ADD_HOOK_FUNCTION(float_one, ctx);
ADD_HOOK_FUNCTION(float_mantissa, ctx);
ADD_HOOK_FUNCTION(float_mantissa_set, ctx);
ADD_HOOK_FUNCTION(float_exponent, ctx);
ADD_HOOK_FUNCTION(float_exponent_set, ctx);
ADD_HOOK_FUNCTION(float_sign, ctx);
ADD_HOOK_FUNCTION(float_sign_set, ctx);

View File

@@ -4774,16 +4774,6 @@ DEFINE_HOOK_FUNCTION(
return float_one_internal;
return float_divide_internal(float_one_internal, float1);
}
DEFINE_HOOK_FUNCTION(
int64_t,
float_exponent,
int64_t float1 )
{
RETURN_IF_INVALID_FLOAT(float1);
if (float1 == 0)
return 0;
return get_exponent(float1);
}
DEFINE_HOOK_FUNCTION(
int64_t,

View File

@@ -2061,7 +2061,7 @@ public:
extern int64_t float_negate(int64_t);
extern int64_t float_sum(int64_t, int64_t);
extern int64_t float_mantissa(int64_t);
extern int64_t float_exponent(int64_t);
#define float_exponent(f) (((int32_t)(((f) >> 54U) & 0xFFU)) - 97)
#define ASSERT_EQUAL(x, y)\
{\
int64_t px = (x);\
@@ -2076,7 +2076,7 @@ public:
int64_t diffman = mx - my;\
if (diffman < 0) diffman *= -1LL;\
if (diffexp < 0) diffexp *= -1;\
if (diffexp > 1 || diffman > 5000000)\
if (diffexp > 1 || diffman > 5000000 || mx < 0 || my < 0)\
rollback((uint32_t) #x, sizeof(#x), __LINE__);\
}
int64_t hook(uint32_t reserved )
@@ -2407,7 +2407,7 @@ public:
extern int64_t float_negate(int64_t);
extern int64_t float_sum(int64_t, int64_t);
extern int64_t float_mantissa(int64_t);
extern int64_t float_exponent(int64_t);
#define float_exponent(f) (((int32_t)(((f) >> 54U) & 0xFFU)) - 97)
#define ASSERT_EQUAL(x, y)\
{\
int64_t px = (x);\
@@ -2422,7 +2422,7 @@ public:
int64_t diffman = mx - my;\
if (diffman < 0) diffman *= -1LL;\
if (diffexp < 0) diffexp *= -1;\
if (diffexp > 1 || diffman > 5000000)\
if (diffexp > 1 || diffman > 5000000 || mx < 0 || my < 0)\
rollback((uint32_t) #x, sizeof(#x), __LINE__);\
}
int64_t hook(uint32_t reserved )
@@ -2492,7 +2492,7 @@ public:
#define INVALID_ARGUMENT -7
#define COMPLEX_NOT_SUPPORTED -39
extern int64_t float_mantissa(int64_t);
extern int64_t float_exponent(int64_t);
#define float_exponent(f) (((int32_t)(((f) >> 54U) & 0xFFU)) - 97)
#define ASSERT_EQUAL(x, y)\
{\
int64_t px = (x);\
@@ -2507,7 +2507,7 @@ public:
int64_t diffman = mx - my;\
if (diffman < 0) diffman *= -1LL;\
if (diffexp < 0) diffexp *= -1;\
if (diffexp > 1 || diffman > 5000000)\
if (diffexp > 1 || diffman > 5000000 || mx < 0 || my < 0)\
rollback((uint32_t) #x, sizeof(#x), __LINE__);\
}
int64_t hook(uint32_t reserved )
@@ -2720,7 +2720,7 @@ public:
extern int64_t float_negate(int64_t);
extern int64_t float_sum(int64_t, int64_t);
extern int64_t float_mantissa(int64_t);
extern int64_t float_exponent(int64_t);
#define float_exponent(f) (((int32_t)(((f) >> 54U) & 0xFFU)) - 97)
#define ASSERT_EQUAL(x, y)\
{\
int64_t px = (x);\
@@ -2735,7 +2735,7 @@ public:
int64_t diffman = mx - my;\
if (diffman < 0) diffman *= -1LL;\
if (diffexp < 0) diffexp *= -1;\
if (diffexp > 1 || diffman > 5000000)\
if (diffexp > 1 || diffman > 5000000 || mx < 0 || my < 0)\
rollback((uint32_t) #x, sizeof(#x), __LINE__);\
}
int64_t hook(uint32_t reserved )
@@ -2826,7 +2826,7 @@ public:
extern int64_t float_negate(int64_t);
extern int64_t float_sum(int64_t, int64_t);
extern int64_t float_mantissa(int64_t);
extern int64_t float_exponent(int64_t);
#define float_exponent(f) (((int32_t)(((f) >> 54U) & 0xFFU)) - 97)
#define ASSERT_EQUAL(x, y)\
{\
int64_t px = (x);\
@@ -2841,7 +2841,7 @@ public:
int64_t diffman = mx - my;\
if (diffman < 0) diffman *= -1LL;\
if (diffexp < 0) diffexp *= -1;\
if (diffexp > 1 || diffman > 5000000)\
if (diffexp > 1 || diffman > 5000000 || mx < 0 || my < 0)\
rollback((uint32_t) #x, sizeof(#x), __LINE__);\
}
int64_t hook(uint32_t reserved )
@@ -3283,8 +3283,6 @@ public:
test_fee_base();
test_float_compare();
test_float_divide();
test_float_exponent();
test_float_exponent();
test_float_exponent_set();
test_float_int();
test_float_invert();