| 1056 | } |
| 1057 | |
| 1058 | static std::string sumExpr(const std::vector<Field>& fields, |
| 1059 | const std::vector<Field>& sideFields, |
| 1060 | const std::vector<std::string>& external, |
| 1061 | bool minimum) { |
| 1062 | std::vector<std::string> terms; |
| 1063 | for (const auto& field : fields) { |
| 1064 | if (field.type != "bytes") { |
| 1065 | terms.push_back("sizeof(" + field.type + ")"); |
| 1066 | } else if (!minimum || !containsField(sideFields, field.lenRef)) { |
| 1067 | terms.push_back(lengthExpr(field, sideFields, external)); |
| 1068 | } |
| 1069 | } |
| 1070 | return sumExpr(terms); |
| 1071 | } |
| 1072 | |
| 1073 | static std::string sumExpr(const std::vector<std::string>& terms) { |
| 1074 | if (terms.empty()) return "0"; |