Fix size calculation to handle negative values and release version 0.3.4

This commit is contained in:
2025-06-22 16:23:53 +02:00
parent 1c23178839
commit 9f152ca8da
2 changed files with 6 additions and 2 deletions

View File

@@ -8,7 +8,7 @@ plugins {
}
group = "nl.astraeus"
version = "0.3.4-SNAPSHOT"
version = "0.3.4"
repositories {
mavenCentral()

View File

@@ -1,5 +1,7 @@
package nl.astraeus.tba
import kotlin.math.max
enum class DataType(
val size: Int,
val bytesUsedInternally: Int = 0
@@ -36,6 +38,8 @@ open class ByteArrayDefinition(
val types: List<Type> = types.toList()
val size: Int by lazy {
this.types.sumOf { it.size }
this.types.sumOf {
max(0, it.size)
}
}
}