Skip to content

Commit fd23131

Browse files
committed
3.3.1+1
1 parent 4d42e58 commit fd23131

File tree

8 files changed

+20
-16
lines changed

8 files changed

+20
-16
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
val build = "0.7.3+7"
2+
val build = "0.7.3+9"
33
id("kx.kotlin") version build
44
// id("kx.dokka") version build
55
id("kx.publish") version build

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pluginManagement {
99
}
1010

1111
gradle.rootProject {
12-
version = "3.3.1"
12+
version = "3.3.1+1"
1313
}
1414

1515
//includeBuild("../build-logic")

src/main/kotlin/unsigned/Ulong.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ data class Ulong(var v: Long = 0) : Number(), Comparable<Ulong> {
3838
override fun toDouble() = toBigInt().toDouble()
3939
override fun toFloat() = toBigInt().toFloat()
4040

41-
override fun toChar() = v.toChar()
41+
override fun toChar() = v.toInt().toChar()
4242

4343
operator fun inc() = Ulong(v + 1)
4444
operator fun dec() = Ulong(v - 1)

src/main/kotlin/unsigned/Ushort.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ data class Ushort(var v: Short = 0) : Number(), Comparable<Ushort> {
4444
override fun toDouble() = toInt().toDouble()
4545
override fun toFloat() = toInt().toFloat()
4646

47-
override fun toChar() = v.toChar()
47+
override fun toChar() = v.toInt().toChar()
4848

4949
operator fun inc() = Ushort(v + 1)
5050
operator fun dec() = Ushort(v - 1)

src/main/kotlin/unsigned/arrays.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ package unsigned
44
fun UbyteArray(size: Int) = UbyteArray(ByteArray(size))
55
fun UbyteArray(size: Int, init: (Int) -> Byte) = UbyteArray(ByteArray(size, init))
66

7-
inline class UbyteArray(val data: ByteArray) {
7+
@JvmInline
8+
value class UbyteArray(val data: ByteArray) {
89

910
operator fun get(index: Int) = Ubyte(data[index])
1011

@@ -17,7 +18,8 @@ inline class UbyteArray(val data: ByteArray) {
1718
fun UshortArray(size: Int) = UshortArray(ShortArray(size))
1819
fun UshortArray(size: Int, init: (Int) -> Short) = UshortArray(ShortArray(size, init))
1920

20-
inline class UshortArray(val data: ShortArray) {
21+
@JvmInline
22+
value class UshortArray(val data: ShortArray) {
2123

2224
operator fun get(index: Int) = Ushort(data[index])
2325

@@ -30,7 +32,8 @@ inline class UshortArray(val data: ShortArray) {
3032
fun UintArray(size: Int) = UintArray(IntArray(size))
3133
fun UintArray(size: Int, init: (Int) -> Int) = UintArray(IntArray(size, init))
3234

33-
inline class UintArray(val data: IntArray) {
35+
@JvmInline
36+
value class UintArray(val data: IntArray) {
3437

3538
operator fun get(index: Int) = Uint(data[index])
3639

@@ -42,7 +45,8 @@ inline class UintArray(val data: IntArray) {
4245
fun UlongArray(size: Int) = UlongArray(LongArray(size))
4346
fun UlongArray(size: Int, init: (Int) -> Long) = UlongArray(LongArray(size, init))
4447

45-
inline class UlongArray(val data: LongArray) {
48+
@JvmInline
49+
value class UlongArray(val data: LongArray) {
4650

4751
operator fun get(index: Int) = Ulong(data[index])
4852

src/main/kotlin/unsigned/unsigned.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fun Number.toUshort() = Ushort(toShort())
1313

1414
// TODO char?
1515

16-
fun Char.toUbyte() = Ubyte(toByte())
17-
fun Char.toUint() = Uint(toInt())
18-
fun Char.toUlong() = Ulong(toLong())
19-
fun Char.toUshort() = Ushort(toShort())
16+
fun Char.toUbyte() = Ubyte(code.toByte())
17+
fun Char.toUint() = Uint(code)
18+
fun Char.toUlong() = Ulong(code.toLong())
19+
fun Char.toUshort() = Ushort(code.toShort())

src/test/kotlin/unsigned/uint.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ class `Uint test` : StringSpec() {
2323
a.toBigInt() shouldBe BigInteger.valueOf(0xffff_ffff)
2424
a.toDouble() shouldBe 0xffff_ffff.toDouble()
2525
a.toFloat() shouldBe 0xffff_ffff.toFloat()
26-
a.toLong() shouldBe 0xffff_ffff.toLong()
26+
a.toLong() shouldBe 0xffff_ffff
2727
a.toInt() shouldBe 0xffff_ffff.toInt()
28-
a.toChar() shouldBe 0xffff_ffff.toChar()
28+
a.toChar() shouldBe 0xffff_ffff.toInt().toChar()
2929
a.toShort() shouldBe 0xffff_ffff.s
3030
a.toByte() shouldBe 0xffff_ffff.b
3131

src/test/kotlin/unsigned/ulong.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ class `Ulong test` : StringSpec() {
2020
a.toBigInt() shouldBe max.toUBigInt()
2121
a.toDouble() shouldBe max.toUBigInt().toDouble()
2222
a.toFloat() shouldBe max.toUBigInt().toFloat()
23-
a.toLong() shouldBe max.toLong()
23+
a.toLong() shouldBe max
2424
a.toInt() shouldBe max.toInt()
25-
a.toChar() shouldBe max.toChar()
25+
a.toChar() shouldBe max.toInt().toChar()
2626
a.toShort() shouldBe max.s
2727
a.toByte() shouldBe max.b
2828

0 commit comments

Comments
 (0)