Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Attributes | List of all members
dart::DoubleInternals Class Reference

#include <double_internals.h>

Public Member Functions

 DoubleInternals (double d)
 
uint64_t AsUint64 () const
 
int Exponent () const
 
uint64_t Significand () const
 
bool IsDenormal () const
 
bool IsSpecial () const
 
int Sign () const
 

Static Public Attributes

static constexpr int kSignificandSize = 53
 

Detailed Description

Definition at line 18 of file double_internals.h.

Constructor & Destructor Documentation

◆ DoubleInternals()

dart::DoubleInternals::DoubleInternals ( double  d)
inlineexplicit

Definition at line 22 of file double_internals.h.

22: d64_(double_to_uint64(d)) {}
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition: main.cc:19
static uint64_t double_to_uint64(double d)

Member Function Documentation

◆ AsUint64()

uint64_t dart::DoubleInternals::AsUint64 ( ) const
inline

Definition at line 25 of file double_internals.h.

25{ return d64_; }

◆ Exponent()

int dart::DoubleInternals::Exponent ( ) const
inline

Definition at line 27 of file double_internals.h.

27 {
28 if (IsDenormal()) return kDenormalExponent;
29
30 uint64_t d64 = AsUint64();
31 int biased_e =
32 static_cast<int>((d64 & kExponentMask) >> kPhysicalSignificandSize);
33 return biased_e - kExponentBias;
34 }
uint64_t AsUint64() const

◆ IsDenormal()

bool dart::DoubleInternals::IsDenormal ( ) const
inline

Definition at line 47 of file double_internals.h.

47 {
48 uint64_t d64 = AsUint64();
49 return (d64 & kExponentMask) == 0;
50 }

◆ IsSpecial()

bool dart::DoubleInternals::IsSpecial ( ) const
inline

Definition at line 54 of file double_internals.h.

54 {
55 uint64_t d64 = AsUint64();
56 return (d64 & kExponentMask) == kExponentMask;
57 }

◆ Sign()

int dart::DoubleInternals::Sign ( ) const
inline

Definition at line 59 of file double_internals.h.

59 {
60 uint64_t d64 = AsUint64();
61 return (d64 & kSignMask) == 0 ? 1 : -1;
62 }

◆ Significand()

uint64_t dart::DoubleInternals::Significand ( ) const
inline

Definition at line 36 of file double_internals.h.

36 {
37 uint64_t d64 = AsUint64();
38 uint64_t significand = d64 & kSignificandMask;
39 if (!IsDenormal()) {
40 return significand + kHiddenBit;
41 } else {
42 return significand;
43 }
44 }

Member Data Documentation

◆ kSignificandSize

constexpr int dart::DoubleInternals::kSignificandSize = 53
staticconstexpr

Definition at line 20 of file double_internals.h.


The documentation for this class was generated from the following file: