Skip to content

Commit 05a56ad

Browse files
committed
- removed default package
1 parent cdffbb6 commit 05a56ad

File tree

5 files changed

+23
-9
lines changed

5 files changed

+23
-9
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# kotlin-unsigned
1+
# kotlin-unsigned.unsigned
22

3-
unsigned support for Kotlin via boxed types
3+
unsigned.unsigned support for Kotlin via boxed types

src/main/kotlin/Byte.kt renamed to src/main/kotlin/unsigned/Byte.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
package unsigned
2+
3+
import unsigned.toUInt
4+
15
/**
26
* Created by elect on 19/01/2017.
37
*/

src/main/kotlin/unsigned.kt renamed to src/main/kotlin/unsigned/unsigned.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package unsigned
2+
13
import java.math.BigInteger
24

35
/**
@@ -34,7 +36,7 @@ infix fun Long.urem(b: Long) = java.lang.Long.remainderUnsigned(this, b)
3436
infix fun Long.ucmp(b: Long) = java.lang.Long.compareUnsigned(this, b)
3537
// Long.ushl(b: Long) is already provided by Kotlin lib
3638

37-
// TODO if == Ubyte?
39+
// TODO if == unsigned.Ubyte?
3840
fun Number.toUbyte() = Ubyte(toByte())
3941
fun Number.toUint() = Uint(this)
4042
fun Number.toUlong() = Ulong(toLong())
@@ -407,7 +409,7 @@ infix fun Int.or(b: Ubyte) = this or b.toInt()
407409
infix fun Int.xor(b: Ubyte) = this xor b.toInt()
408410
infix fun Int.shl(b: Ubyte) = this shl b.toInt()
409411
infix fun Int.shr(b: Ubyte) = this shr b.toInt()
410-
// Int.inv() is already provided by Kotlin lib
412+
// Int.unsigned.inv() is already provided by Kotlin lib
411413
infix operator fun Int.compareTo(b: Ubyte) = Integer.compareUnsigned(this, b.toInt())
412414

413415

@@ -421,7 +423,7 @@ infix fun Int.or(b: Uint) = this or b.toInt()
421423
infix fun Int.xor(b: Uint) = this xor b.toInt()
422424
infix fun Int.shl(b: Uint) = this shl b.toInt()
423425
infix fun Int.shr(b: Uint) = this shr b.toInt()
424-
// Int.inv() is already provided by Kotlin lib
426+
// Int.unsigned.inv() is already provided by Kotlin lib
425427
infix operator fun Int.compareTo(b: Uint) = Integer.compareUnsigned(this, b.toInt())
426428

427429

@@ -433,7 +435,7 @@ operator fun Long.rem(b: Ulong) = java.lang.Long.remainderUnsigned(this, b.toLon
433435
infix fun Long.and(b: Ulong) = this and b.toLong()
434436
infix fun Long.or(b: Ulong) = this or b.toLong()
435437
infix fun Long.xor(b: Ulong) = this xor b.toLong()
436-
// no main.shl, main.shr, since they need int
438+
// no main.unsigned.shl, main.unsigned.shr, since they need int
437439
infix operator fun Long.compareTo(b: Ulong) = java.lang.Long.compareUnsigned(this, b.toLong())
438440

439441

@@ -461,5 +463,5 @@ infix fun Int.or(b: Ushort) = this or b.toInt()
461463
infix fun Int.xor(b: Ushort) = this xor b.toInt()
462464
infix fun Int.shl(b: Ushort) = this shl b.toInt()
463465
infix fun Int.shr(b: Ushort) = this shr b.toInt()
464-
// Int.inv() is already provided by Kotlin lib
466+
// Int.unsigned.inv() is already provided by Kotlin lib
465467
infix operator fun Int.compareTo(b: Ushort) = Integer.compareUnsigned(this, b.toInt())

src/test/kotlin/test.kt renamed to src/test/kotlin/unsigned/test.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
package unsigned
2+
3+
import unsigned.toUInt
4+
import unsigned.toUint
5+
import unsigned.ui
6+
17
/**
28
* Created by elect on 19/01/2017.
39
*/

src/test/kotlin/unsigned.kt renamed to src/test/kotlin/unsigned/unsigned.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package unsigned
2+
13
import io.kotlintest.KTestJUnitRunner
24
import io.kotlintest.matchers.be
35
import io.kotlintest.specs.StringSpec
@@ -316,10 +318,10 @@ class unsigned : StringSpec() {
316318

317319
val max = "ffff_ffff__ffff_ffff".hL
318320

319-
Ulong(Ulong.MAX_VALUE).v shouldBe max
321+
Ulong(Ulong.Companion.MAX_VALUE).v shouldBe max
320322
Ulong("18446744073709551615").v shouldBe max
321323

322-
var a = Ulong(Ulong.MAX_VALUE)
324+
var a = Ulong(Ulong.Companion.MAX_VALUE)
323325

324326
a.toBigInteger() shouldBe max.toUBigInt()
325327
a.toDouble() shouldBe max.toUBigInt().toDouble()

0 commit comments

Comments
 (0)