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

Function isFieldZero

valdi_protobuf/test/Field_tests.cpp:17–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15
16template<typename T>
17bool isFieldZero(T value) {
18 const auto* ptr = reinterpret_cast<const Byte*>(&value);
19
20 for (size_t i = 0; i < sizeof(T); i++) {
21 if (ptr[i] != 0) {
22 return false;
23 }
24 }
25
26 return true;
27}
28
29template<typename CType, enum WireFormat::FieldType DeclaredType>
30static std::optional<CType> readPrimitive(ByteBuffer& buffer) {

Callers 1

testFieldMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected