MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / WriteDouble

Method WriteDouble

rapidjson/writer.h:317–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

315 }
316
317 bool WriteDouble(double d) {
318 if (internal::Double(d).IsNanOrInf()) {
319 if (!(writeFlags & kWriteNanAndInfFlag))
320 return false;
321 if (internal::Double(d).IsNan()) {
322 PutReserve(*os_, 3);
323 PutUnsafe(*os_, 'N'); PutUnsafe(*os_, 'a'); PutUnsafe(*os_, 'N');
324 return true;
325 }
326 if (internal::Double(d).Sign()) {
327 PutReserve(*os_, 9);
328 PutUnsafe(*os_, '-');
329 }
330 else
331 PutReserve(*os_, 8);
332 PutUnsafe(*os_, 'I'); PutUnsafe(*os_, 'n'); PutUnsafe(*os_, 'f');
333 PutUnsafe(*os_, 'i'); PutUnsafe(*os_, 'n'); PutUnsafe(*os_, 'i'); PutUnsafe(*os_, 't'); PutUnsafe(*os_, 'y');
334 return true;
335 }
336
337 char buffer[25];
338 char* end = internal::dtoa(d, buffer, maxDecimalPlaces_);
339 PutReserve(*os_, static_cast<size_t>(end - buffer));
340 for (char* p = buffer; p != end; ++p)
341 PutUnsafe(*os_, static_cast<typename TargetEncoding::Ch>(*p));
342 return true;
343 }
344
345 bool WriteString(const Ch* str, SizeType length) {
346 static const typename TargetEncoding::Ch hexDigits[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };

Callers

nothing calls this directly

Calls 7

DoubleClass · 0.85
dtoaFunction · 0.85
IsNanOrInfMethod · 0.80
IsNanMethod · 0.80
SignMethod · 0.80
PutReserveFunction · 0.70
PutUnsafeFunction · 0.70

Tested by

no test coverage detected