MCPcopy Create free account
hub / github.com/apple/foundationdb / getDouble

Method getDouble

fdbclient/Tuple.cpp:397–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

395}
396
397double Tuple::getDouble(size_t index) const {
398 if (index >= offsets.size()) {
399 throw invalid_tuple_index();
400 }
401 ASSERT_LT(offsets[index], data.size());
402 uint8_t code = data[offsets[index]];
403 if (code != 0x21) {
404 throw invalid_tuple_data_type();
405 }
406
407 double swap;
408 uint8_t* bytes = (uint8_t*)&swap;
409 ASSERT_LE(offsets[index] + 1 + sizeof(double), data.size());
410 swap = *(double*)(data.begin() + offsets[index] + 1);
411 adjustFloatingPoint(bytes, sizeof(double), false);
412
413 return bigEndianDouble(swap);
414}
415
416Versionstamp Tuple::getVersionstamp(size_t index) const {
417 if (index >= offsets.size()) {

Calls 4

adjustFloatingPointFunction · 0.85
bigEndianDoubleFunction · 0.70
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected