This is an automated email from the ASF dual-hosted git repository.

hutcheb pushed a commit to branch plc4py/integration-test
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 7393955df209d732268258e371f92e3cbc59e740
Author: Ben Hutcheson <ben.hut...@gmail.com>
AuthorDate: Tue May 7 04:35:48 2024 +0200

    fix(plc4py): Fix padding length
---
 .../resources/templates/python/complex-type-template.python.ftlh     | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git 
a/code-generation/language-python/src/main/resources/templates/python/complex-type-template.python.ftlh
 
b/code-generation/language-python/src/main/resources/templates/python/complex-type-template.python.ftlh
index c950898cf5..53fe25047b 100644
--- 
a/code-generation/language-python/src/main/resources/templates/python/complex-type-template.python.ftlh
+++ 
b/code-generation/language-python/src/main/resources/templates/python/complex-type-template.python.ftlh
@@ -459,9 +459,8 @@ class ${type.name}<#if 
type.isDiscriminatedParentTypeDefinition()></#if>(<#if ty
 
         # Padding Field (padding)
         <#-- We're replacing the "lastItem" with 'false' here as the item 
itself can't know if it is the last -->
-        int _timesPadding = int(${helper.toParseExpression(paddingField, 
helper.intTypeReference, paddingField.paddingCondition, parserArguments)})
-        while _timesPadding-- > 0:
-            length_in_bits += ${simpleTypeReference.sizeInBits}
+        _timesPadding: int = int(${helper.toParseExpression(paddingField, 
helper.intTypeReference, paddingField.paddingCondition, parserArguments)})
+        length_in_bits = ${simpleTypeReference.sizeInBits} * _timesPadding
 
         <#break>
     <#case "reserved">

Reply via email to