16 static uint8_t MostSignificantDigit (uint64_t value)
27 static uint64_t PowerOfTen (uint8_t n)
38 std::ostream &
operator << (std::ostream &os,
const int64x64_t &value)
40 int64_t hi = value.GetHigh ();
41 os << ((hi<0) ?
"-" :
"+") << ((hi<0) ? -hi : hi) <<
".";
42 uint64_t low = value.GetLow ();
43 uint8_t msd = MostSignificantDigit (~((uint64_t)0));
47 uint64_t pow = PowerOfTen (msd);
48 uint8_t digit = low / pow;
50 os << (uint16_t) digit;
52 }
while (msd > 0 && low > 0);
56 static uint64_t ReadDigits (std::string str)
58 const char *buf = str.c_str ();
63 retval += *buf - 0x30;
69 std::istream &
operator >> (std::istream &is, int64x64_t &value)
76 std::string::size_type cur;
77 cur = str.find_first_not_of (
" ");
78 std::string::size_type next;
80 next = str.find (
"-", cur);
81 if (next != std::string::npos)
88 next = str.find (
"+", cur);
89 if (next != std::string::npos)
102 next = str.find (
".", cur);
103 if (next != std::string::npos)
105 hi = ReadDigits (str.substr (cur, next-cur));
106 lo = ReadDigits (str.substr (next+1, str.size ()-(next+1)));
110 hi = ReadDigits (str.substr (cur, str.size ()-cur));
113 hi = negative ? -hi : hi;
114 value = int64x64_t (hi, lo);
std::istream & operator>>(std::istream &is, Angles &a)
#define NS_ASSERT(condition)
#define NS_LOG_COMPONENT_DEFINE(name)
std::ostream & operator<<(std::ostream &os, const Angles &a)