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

Method getFloat

bindings/flow/Tuple.cpp:405–422  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403}
404
405float Tuple::getFloat(size_t index) const {
406 if (index >= offsets.size()) {
407 throw invalid_tuple_index();
408 }
409 ASSERT_LT(offsets[index], data.size());
410 uint8_t code = data[offsets[index]];
411 if (code != FLOAT_CODE) {
412 throw invalid_tuple_data_type();
413 }
414
415 float swap;
416 uint8_t* bytes = (uint8_t*)&swap;
417 ASSERT_LE(offsets[index] + 1 + sizeof(float), data.size());
418 swap = *(float*)(data.begin() + offsets[index] + 1);
419 adjust_floating_point(bytes, sizeof(float), false);
420
421 return bigEndianFloat(swap);
422}
423
424double Tuple::getDouble(size_t index) const {
425 if (index >= offsets.size()) {

Callers 4

tupleToStringFunction · 0.45
callMethod · 0.45
callMethod · 0.45
callMethod · 0.45

Calls 4

adjust_floating_pointFunction · 0.85
bigEndianFloatFunction · 0.70
sizeMethod · 0.45
beginMethod · 0.45

Tested by 4

tupleToStringFunction · 0.36
callMethod · 0.36
callMethod · 0.36
callMethod · 0.36