MCPcopy Create free account
hub / github.com/Snapchat/Valdi / getSInt32

Method getSInt32

valdi_protobuf/src/valdi_protobuf/Field.cpp:435–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

433}
434
435int32_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
450void Field::setSInt32(int32_t v) {
451 setVarint(WireFormat::ZigZagEncode64(static_cast<int64_t>(v)));

Callers 3

TESTFunction · 0.80

Calls

no outgoing calls

Tested by 2

TESTFunction · 0.64