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

Method getFloat

fdbclient/Tuple.cpp:378–395  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

376}
377
378float Tuple::getFloat(size_t index) const {
379 if (index >= offsets.size()) {
380 throw invalid_tuple_index();
381 }
382 ASSERT_LT(offsets[index], data.size());
383 uint8_t code = data[offsets[index]];
384 if (code != 0x20) {
385 throw invalid_tuple_data_type();
386 }
387
388 float swap;
389 uint8_t* bytes = (uint8_t*)&swap;
390 ASSERT_LE(offsets[index] + 1 + sizeof(float), data.size());
391 swap = *(float*)(data.begin() + offsets[index] + 1);
392 adjustFloatingPoint(bytes, sizeof(float), false);
393
394 return bigEndianFloat(swap);
395}
396
397double Tuple::getDouble(size_t index) const {
398 if (index >= offsets.size()) {

Callers 2

insertMethod · 0.45
Tuple.cppFile · 0.45

Calls 4

adjustFloatingPointFunction · 0.85
bigEndianFloatFunction · 0.70
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected