Skip to content

Commit

Permalink
Fix invalid alloc_size value. Add sizeof(protocol_hash_type)
Browse files Browse the repository at this point in the history
  • Loading branch information
ameharoo committed Sep 20, 2024
1 parent 3d68840 commit 47c13a9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions templates/cpp/Type.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% from 'cpp/Hashtype.j2' import HashAssignment %}
{% from 'cpp/Hashtype.j2' import HashAssignment, HashType %}

{% macro var_static_size_name(msg) -%}{{ msg | message_type | upper }}_STATIC_SIZE{% endmacro %}

Expand All @@ -22,7 +22,7 @@

{% block before_definition %}
{% block static_size_definition %}
constexpr std::size_t {{ var_static_size_name(msg) }} =
constexpr std::size_t {{ var_static_size_name(msg) }} = sizeof({{ HashType(data.protocol_hash_bytes_count) }}) +
{%- if msg | message_novar_fields | length > 0 %}
({{ msg | message_novar_fields | map('field_type') | map('wrap', 'sizeof(', ')') | join(' + ') }});
{%- else %}
Expand Down

0 comments on commit 47c13a9

Please sign in to comment.