| 433 | } |
| 434 | |
| 435 | int32_t Field::getSInt32() const { |
| 436 | switch (_type) { |
| 437 | case InternalType::Varint: |
| 438 | return WireFormat::ZigZagDecode32(static_cast<uint32_t>(_data.varint)); |
| 439 | case InternalType::Fixed64: |
| 440 | return static_cast<int32_t>(_data.fixed64); |
| 441 | case InternalType::Fixed32: |
| 442 | return static_cast<int32_t>(_data.fixed32); |
| 443 | case InternalType::Unset: |
| 444 | case InternalType::Raw: |
| 445 | case InternalType::Ref: |
| 446 | return 0; |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | void Field::setSInt32(int32_t v) { |
| 451 | setVarint(WireFormat::ZigZagEncode64(static_cast<int64_t>(v))); |
no outgoing calls