| 376 | } |
| 377 | |
| 378 | float 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 | |
| 397 | double Tuple::getDouble(size_t index) const { |
| 398 | if (index >= offsets.size()) { |
no test coverage detected