| 583 | } |
| 584 | |
| 585 | float Field::getFloat() const { |
| 586 | switch (_type) { |
| 587 | case InternalType::Varint: |
| 588 | return static_cast<float>(WireFormat::DecodeDouble(_data.varint)); |
| 589 | case InternalType::Fixed64: |
| 590 | return static_cast<float>(WireFormat::DecodeDouble(_data.fixed64)); |
| 591 | case InternalType::Fixed32: |
| 592 | return WireFormat::DecodeFloat(_data.fixed32); |
| 593 | case InternalType::Unset: |
| 594 | case InternalType::Raw: |
| 595 | case InternalType::Ref: |
| 596 | return 0; |
| 597 | } |
| 598 | } |
| 599 | |
| 600 | void Field::setFloat(float v) { |
| 601 | setFixed32(WireFormat::EncodeFloat(v)); |
no outgoing calls