mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 13:45:40 +00:00
softfloat: add float{32,64}_is_{de,}normal
This paves the way for upcoming work. Backports commit 588e6dfd8774e6da56b6995611655fbe59ff564a from qemu
This commit is contained in:
parent
3d0359c0f5
commit
3a8f7d6d84
|
@ -469,6 +469,16 @@ static inline int float32_is_zero_or_denormal(float32 a)
|
|||
return (float32_val(a) & 0x7f800000) == 0;
|
||||
}
|
||||
|
||||
static inline bool float32_is_normal(float32 a)
|
||||
{
|
||||
return ((float32_val(a) + 0x00800000) & 0x7fffffff) >= 0x01000000;
|
||||
}
|
||||
|
||||
static inline bool float32_is_denormal(float32 a)
|
||||
{
|
||||
return float32_is_zero_or_denormal(a) && !float32_is_zero(a);
|
||||
}
|
||||
|
||||
static inline float32 float32_set_sign(float32 a, int sign)
|
||||
{
|
||||
return make_float32((float32_val(a) & 0x7fffffff) | (sign << 31));
|
||||
|
@ -611,6 +621,16 @@ static inline int float64_is_zero_or_denormal(float64 a)
|
|||
return (float64_val(a) & 0x7ff0000000000000LL) == 0;
|
||||
}
|
||||
|
||||
static inline bool float64_is_normal(float64 a)
|
||||
{
|
||||
return ((float64_val(a) + (1ULL << 52)) & -1ULL >> 1) >= 1ULL << 53;
|
||||
}
|
||||
|
||||
static inline bool float64_is_denormal(float64 a)
|
||||
{
|
||||
return float64_is_zero_or_denormal(a) && !float64_is_zero(a);
|
||||
}
|
||||
|
||||
static inline float64 float64_set_sign(float64 a, int sign)
|
||||
{
|
||||
return make_float64((float64_val(a) & 0x7fffffffffffffffULL)
|
||||
|
|
Loading…
Reference in a new issue