Closed kuangtu closed 1 year ago
<field name="serialNumber" id="1" type="uint64"/> <!-- 8 -->
<field name="modelYear" id="2" type="ModelYear"/> <!-- 2 -->
<field name="available" id="3" type="BooleanType"/> <!-- 1 -->
<field name="code" id="4" type="Model"/> <!-- 1 -->
<field name="someNumbers" id="5" type="someNumbers"/> <!-- 4 * 4 = 16 -->
<field name="vehicleCode" id="6" type="VehicleCode"/> <!-- 6 -->
<field name="extras" id="7" type="OptionalExtras"/> <!-- 1 -->
<field name="discountedModel" id="8" type="Model" presence="constant" valueRef="Model.C"/> <!-- 0 -->
<field name="engine" id="9" type="Engine"/> <!-- 10 -->
total = 45
looks like your calculation not includes actual size of someNumbers
which is 4*4=16 (not 4)
<field name="serialNumber" id="1" type="uint64"/> <!-- 8 --> <field name="modelYear" id="2" type="ModelYear"/> <!-- 2 --> <field name="available" id="3" type="BooleanType"/> <!-- 1 --> <field name="code" id="4" type="Model"/> <!-- 1 --> <field name="someNumbers" id="5" type="someNumbers"/> <!-- 4 * 4 = 16 --> <field name="vehicleCode" id="6" type="VehicleCode"/> <!-- 6 --> <field name="extras" id="7" type="OptionalExtras"/> <!-- 1 --> <field name="discountedModel" id="8" type="Model" presence="constant" valueRef="Model.C"/> <!-- 0 --> <field name="engine" id="9" type="Engine"/> <!-- 10 -->
total = 45
looks like your calculation not includes actual size of
someNumbers
which is 4*4=16 (not 4)
Yes!the type is:
primitiveType is uint32, 4 bytes, and length is 4, sum is 4*4 = 16. Thanks!
I compile the project and run ExampleUsingGeneratedStub successfully. In generated-src CarEncoder.java:
The BLOCK_LENGTH is 45.from the "Simple_Binary_Encoding_V1.0_with_Errata_November_2020.pdf", it shows the "blocklength" is total space reserved for the root level of the message not counting any repeating groups or variable-length fields.
the message schema.xml is:
I caculate the blocklength is:
Ref the specification "The block size must be at least the sum of lengths of all fields at the root level of the message, and that is its default value. However, it may be set larger to reserve more space to effect alignment of blocks. This is specified by setting the blockLength attribute in a message schema." if the blocklength is larger than reserve more space, settting by "blockLength attribute in a message schema." Is there any wrong with my calclucation? Thanks!