| 403 | } |
| 404 | |
| 405 | float 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 | |
| 424 | double Tuple::getDouble(size_t index) const { |
| 425 | if (index >= offsets.size()) { |