You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2022/01/30 12:49:30 UTC

[plc4x] 02/05: refactor(code-generation): Changed the implementation of getSizeInBytes to be a bit more correct.

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

cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 2ce32ef2d18d91e175617cab2c1b0ca43cc51c94
Author: cdutz <ch...@c-ware.de>
AuthorDate: Sun Jan 30 13:26:05 2022 +0100

    refactor(code-generation): Changed the implementation of getSizeInBytes to be a bit more correct.
---
 .../src/main/resources/templates/java/model-template.java.ftlh          | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/code-generation/language-java/src/main/resources/templates/java/model-template.java.ftlh b/code-generation/language-java/src/main/resources/templates/java/model-template.java.ftlh
index 48e19ac..c994904 100644
--- a/code-generation/language-java/src/main/resources/templates/java/model-template.java.ftlh
+++ b/code-generation/language-java/src/main/resources/templates/java/model-template.java.ftlh
@@ -312,7 +312,7 @@ public<#if type.isDiscriminatedParentTypeDefinition()> abstract</#if> class ${ty
 
     @Override
     public int getLengthInBytes() {
-        return getLengthInBits() / 8;
+        return (int) Math.ceil((float) getLengthInBits() / 8.0);
     }
 
     @Override