translator: add custom type size dependenton on architecture
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
external fun kotlinclib_boolean_size(): Int
|
||||
|
||||
class BooleanArray(var size: Int) {
|
||||
val data: Int
|
||||
|
||||
@@ -5,7 +7,7 @@ class BooleanArray(var size: Int) {
|
||||
//size: Int
|
||||
|
||||
init {
|
||||
this.data = malloc_array(this.size)
|
||||
this.data = malloc_array(kotlinclib_boolean_size() * this.size)
|
||||
}
|
||||
|
||||
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
||||
@@ -19,8 +21,7 @@ class BooleanArray(var size: Int) {
|
||||
operator fun set(index: Int, value: Boolean) {
|
||||
if (value == true) {
|
||||
kotlinclib_set_byte(this.data, index, 1.toByte())
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
kotlinclib_set_byte(this.data, index, 0.toByte())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
external fun malloc_array(size: Int): Int
|
||||
external fun kotlinclib_get_byte(src: Int, index: Int): Byte
|
||||
external fun kotlinclib_set_byte(src: Int, index: Int, value: Byte)
|
||||
external fun kotlinclib_byte_size(): Int
|
||||
|
||||
|
||||
class ByteArray(var size: Int) {
|
||||
@@ -10,7 +11,7 @@ class ByteArray(var size: Int) {
|
||||
//size: Int
|
||||
|
||||
init {
|
||||
this.data = malloc_array(this.size)
|
||||
this.data = malloc_array(kotlinclib_byte_size() * this.size)
|
||||
}
|
||||
|
||||
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
external fun kotlinclib_get_int(src: Int, index: Int): Int
|
||||
external fun kotlinclib_set_int(src: Int, index: Int, value: Int)
|
||||
external fun kotlinclib_int_size(): Int
|
||||
|
||||
|
||||
class IntArray(var size: Int) {
|
||||
@@ -9,7 +10,7 @@ class IntArray(var size: Int) {
|
||||
//size: Int
|
||||
|
||||
init {
|
||||
this.data = malloc_array(4 * this.size)
|
||||
this.data = malloc_array(kotlinclib_int_size() * this.size)
|
||||
}
|
||||
|
||||
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
external fun kotlinclib_get_short(src: Int, index: Int): Short
|
||||
external fun kotlinclib_set_short(src: Int, index: Int, value: Short)
|
||||
external fun kotlinclib_short_size(): Int
|
||||
|
||||
|
||||
class ShortArray(var size: Int) {
|
||||
@@ -9,7 +10,7 @@ class ShortArray(var size: Int) {
|
||||
//size: Int
|
||||
|
||||
init {
|
||||
this.data = malloc_array(this.size)
|
||||
this.data = malloc_array(kotlinclib_short_size() * this.size)
|
||||
}
|
||||
|
||||
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
||||
|
||||
Reference in New Issue
Block a user