mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:17:36 +00:00
LibM: Specialiase FloatExtractor for long double as well
This commit is contained in:
parent
a13f2b7df3
commit
190952675e
1 changed files with 20 additions and 0 deletions
|
@ -24,6 +24,8 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <AK/Platform.h>
|
||||||
|
#include <AK/StdLibExtras.h>
|
||||||
#include <LibC/assert.h>
|
#include <LibC/assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@ -67,6 +69,24 @@ enum class RoundingMode {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
union FloatExtractor;
|
union FloatExtractor;
|
||||||
|
|
||||||
|
#if ARCH(I386) || ARCH(X86_64)
|
||||||
|
// This assumes long double is 80 bits, which is true with GCC on Intel platforms
|
||||||
|
template<>
|
||||||
|
union FloatExtractor<long double> {
|
||||||
|
static const int mantissa_bits = 64;
|
||||||
|
static const unsigned long long mantissa_max = ~0u;
|
||||||
|
static const int exponent_bias = 16383;
|
||||||
|
static const int exponent_bits = 15;
|
||||||
|
static const unsigned exponent_max = 32767;
|
||||||
|
struct {
|
||||||
|
unsigned long long mantissa;
|
||||||
|
unsigned exponent : 15;
|
||||||
|
unsigned sign : 1;
|
||||||
|
};
|
||||||
|
long double d;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
union FloatExtractor<double> {
|
union FloatExtractor<double> {
|
||||||
static const int mantissa_bits = 52;
|
static const int mantissa_bits = 52;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue