Fix size calculation to handle negative values and release version 0.3.4
This commit is contained in:
@@ -8,7 +8,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = "nl.astraeus"
|
||||
version = "0.3.4-SNAPSHOT"
|
||||
version = "0.3.4"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user