3#include <softfloat.hpp>
5namespace sysio {
namespace chain {
namespace webassembly {
6 static constexpr uint32_t inv_float_eps = 0x4B000000;
7 static constexpr uint64_t inv_double_eps = 0x4330000000000000;
13 std::memcpy((
char*)&
ret, (
char*)&
r,
sizeof(
ret));
19 std::memcpy((
char*)&
ret, (
char*)&
r,
sizeof(
ret));
25 std::memcpy((
char*)&
ret, (
char*)&
r,
sizeof(
ret));
31 std::memcpy((
char*)&
ret, (
char*)&
r,
sizeof(
ret));
46 return ::f32_lt(
a,b) ? af : bf;
60 return ::f32_lt(
a, b ) ? bf : af;
67 a.v =
a.v | (sign_of_b << 31);
90 int e = (int)(
a.v >> 23 & 0xFF) - 0X7F;
112 int e = (int)(
a.v >> 23 & 0xFF) - 0X7F;
133 int e = (int)(
a.v >> 23 & 0xff) - 0x7f + 9;
147 int e =
a.v>>23 & 0xff;
157 return s ? -0.0f : 0.0f;
211 return ::f64_lt(
a, b ) ? af : bf;
222 return ::f64_lt(
a, b ) ? bf : af;
229 a.v =
a.v | (sign_of_b << 63);
254 int e =
a.
v >> 52 & 0x7ff;
256 if (e >= 0x3ff+52 ||
::f64_eq(
a, { 0 } ))
265 return a.v >> 63 ? -0.0 : 1.0;
277 int e =
a.
v >> 52 & 0x7FF;
279 if (
a.v == 0x8000000000000000) {
282 if (e >= 0x3FF+52 ||
a.v == 0) {
290 return a.v>>63 ? -1.0 : 0.0;
301 int e = (int)(
a.v >> 52 & 0x7ff) - 0x3ff + 12;
316 int e = (
a.v >> 52 & 0x7FF);
326 return s ? -0.0 : 0.0;
364 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error,
"Error, f32.convert_s/i32 overflow" );
367 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error,
"Error, f32.convert_s/i32 unrepresentable");
373 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error,
"Error, f64.convert_s/i32 overflow");
375 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error,
"Error, f64.convert_s/i32 unrepresentable");
381 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error,
"Error, f32.convert_u/i32 overflow");
383 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error,
"Error, f32.convert_u/i32 unrepresentable");
389 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error,
"Error, f64.convert_u/i32 overflow");
391 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error,
"Error, f64.convert_u/i32 unrepresentable");
397 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error,
"Error, f32.convert_s/i64 overflow");
399 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error,
"Error, f32.convert_s/i64 unrepresentable");
405 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error,
"Error, f64.convert_s/i64 overflow");
407 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error,
"Error, f64.convert_s/i64 unrepresentable");
414 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error,
"Error, f32.convert_u/i64 overflow");
416 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error,
"Error, f32.convert_u/i64 unrepresentable");
422 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error,
"Error, f64.convert_u/i64 overflow");
424 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error,
"Error, f64.convert_u/i64 unrepresentable");
double _sysio_f64_add(double, double) const
float _sysio_f32_mul(float, float) const
double _sysio_f64_div(double, double) const
int64_t _sysio_f64_trunc_i64s(double) const
double _sysio_f64_abs(double) const
uint32_t _sysio_f32_trunc_i32u(float) const
bool _sysio_f64_le(double, double) const
float _sysio_ui64_to_f32(uint64_t) const
bool _sysio_f32_lt(float, float) const
double _sysio_f64_mul(double, double) const
float _sysio_f32_copysign(float, float) const
double _sysio_ui32_to_f64(uint32_t) const
uint64_t _sysio_f64_trunc_i64u(double) const
bool _sysio_f64_ge(double, double) const
int32_t _sysio_f32_trunc_i32s(float) const
float _sysio_ui32_to_f32(uint32_t) const
double _sysio_f64_sqrt(double) const
double _sysio_i64_to_f64(int64_t) const
uint64_t _sysio_f32_trunc_i64u(float) const
float _sysio_i64_to_f32(int64_t) const
bool _sysio_f64_eq(double, double) const
float _sysio_f32_floor(float) const
bool _sysio_f32_gt(float, float) const
double _sysio_f64_sub(double, double) const
double _sysio_ui64_to_f64(uint64_t) const
float _sysio_f32_neg(float) const
float _sysio_f32_add(float, float) const
float _sysio_f32_sub(float, float) const
float _sysio_f64_demote(double) const
float _sysio_f32_div(float, float) const
double _sysio_f32_promote(float) const
double _sysio_f64_ceil(double) const
double _sysio_f64_floor(double) const
float _sysio_i32_to_f32(int32_t) const
bool _sysio_f64_lt(double, double) const
float _sysio_f32_nearest(float) const
bool _sysio_f32_le(float, float) const
bool _sysio_f64_gt(double, double) const
int64_t _sysio_f32_trunc_i64s(float) const
float _sysio_f32_trunc(float) const
float _sysio_f32_max(float, float) const
bool _sysio_f32_ge(float, float) const
float _sysio_f32_ceil(float) const
double _sysio_f64_copysign(double, double) const
double _sysio_f64_min(double, double) const
double _sysio_f64_trunc(double) const
double _sysio_f64_max(double, double) const
bool _sysio_f32_ne(float, float) const
int32_t _sysio_f64_trunc_i32s(double) const
uint32_t _sysio_f64_trunc_i32u(double) const
float _sysio_f32_min(float, float) const
bool _sysio_f32_eq(float, float) const
double _sysio_i32_to_f64(int32_t) const
double _sysio_f64_neg(double) const
float _sysio_f32_sqrt(float) const
double _sysio_f64_nearest(double) const
float _sysio_f32_abs(float) const
bool _sysio_f64_ne(double, double) const
#define FC_THROW_EXCEPTION(EXCEPTION, FORMAT,...)
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
float32_t f32_add(float32_t a, float32_t b)
float32_t f32_div(float32_t a, float32_t b)
bool f32_eq(float32_t a, float32_t b)
bool f32_le(float32_t a, float32_t b)
bool f32_lt(float32_t a, float32_t b)
float32_t f32_mul(float32_t a, float32_t b)
float32_t f32_sqrt(float32_t a)
float32_t f32_sub(float32_t a, float32_t b)
float64_t f32_to_f64(float32_t a)
int_fast32_t f32_to_i32(float32_t a, uint_fast8_t roundingMode, bool exact)
int_fast64_t f32_to_i64(float32_t a, uint_fast8_t roundingMode, bool exact)
uint_fast32_t f32_to_ui32(float32_t a, uint_fast8_t roundingMode, bool exact)
uint_fast64_t f32_to_ui64(float32_t a, uint_fast8_t roundingMode, bool exact)
float64_t f64_add(float64_t a, float64_t b)
float64_t f64_div(float64_t a, float64_t b)
bool f64_eq(float64_t a, float64_t b)
bool f64_le(float64_t a, float64_t b)
bool f64_lt(float64_t a, float64_t b)
float64_t f64_mul(float64_t a, float64_t b)
float64_t f64_sqrt(float64_t a)
float64_t f64_sub(float64_t a, float64_t b)
float32_t f64_to_f32(float64_t a)
int_fast32_t f64_to_i32(float64_t a, uint_fast8_t roundingMode, bool exact)
int_fast64_t f64_to_i64(float64_t a, uint_fast8_t roundingMode, bool exact)
uint_fast32_t f64_to_ui32(float64_t a, uint_fast8_t roundingMode, bool exact)
uint_fast64_t f64_to_ui64(float64_t a, uint_fast8_t roundingMode, bool exact)
float32_t i32_to_f32(int32_t a)
float64_t i32_to_f64(int32_t a)
float32_t i64_to_f32(int64_t a)
float64_t i64_to_f64(int64_t a)
float64_t ui64_to_f64(uint64_t)
float32_t ui32_to_f32(uint32_t)
float32_t ui64_to_f32(uint64_t)
float64_t ui32_to_f64(uint32_t)
float32_t to_softfloat32(float f)
double from_softfloat64(float64_t d)
bool f64_sign_bit(float64_t f)
bool f32_sign_bit(float32_t f)
float64_t to_softfloat64(double d)
float from_softfloat32(float32_t f)
unsigned __int64 uint64_t