@@ -8,13 +8,15 @@ import java.math.BigInteger
88fun Long.toUByte () = toByte()
99fun Long.toUShort () = toShort()
1010fun Long.toUInt () = toInt()
11- fun Long.toBigInt () = BigInteger (java.lang.Long .toUnsignedString(this ))
1211
1312fun Long.toUbyte () = Ubyte (this )
1413fun Long.toUshort () = Ushort (this )
1514fun Long.toUint () = Uint (this )
1615fun Long.toUlong () = Ulong (this )
1716
17+ fun Long.toBigInt (): BigInteger = BigInteger .valueOf(this )
18+ fun Long.toUBigInt (): BigInteger = BigInteger (java.lang.Long .toUnsignedString(this ))
19+
1820val Long .ub
1921 get() = toUbyte()
2022val Long .ui
@@ -24,24 +26,24 @@ val Long.ul
2426val Long .us
2527 get() = toUshort()
2628
27- infix fun Long.udiv (b : Byte ) = (toBigInt () / b.toBigInt ()).toLong()
28- infix fun Long.urem (b : Byte ) = (toBigInt () % b.toBigInt ()).toLong()
29- infix fun Long.ucmp (b : Byte ) = toBigInt ().compareTo(b.toBigInt ())
30- infix fun Long.ushr (b : Byte ) = (toBigInt () ushr b.toUInt()).toLong()
29+ infix fun Long.udiv (b : Byte ) = (toUBigInt () / b.toUBigInt ()).toLong()
30+ infix fun Long.urem (b : Byte ) = (toUBigInt () % b.toUBigInt ()).toLong()
31+ infix fun Long.ucmp (b : Byte ) = toUBigInt ().compareTo(b.toUBigInt ())
32+ infix fun Long.ushr (b : Byte ) = (toUBigInt () ushr b.toUInt()).toLong()
3133
32- infix fun Long.udiv (b : Short ) = (toBigInt () / b.toBigInt ()).toLong()
33- infix fun Long.urem (b : Short ) = (toBigInt () % b.toBigInt ()).toLong()
34- infix fun Long.ucmp (b : Short ) = toBigInt ().compareTo(b.toBigInt ())
35- infix fun Long.ushr (b : Short ) = (toBigInt () ushr b.toUInt()).toLong()
34+ infix fun Long.udiv (b : Short ) = (toUBigInt () / b.toUBigInt ()).toLong()
35+ infix fun Long.urem (b : Short ) = (toUBigInt () % b.toUBigInt ()).toLong()
36+ infix fun Long.ucmp (b : Short ) = toUBigInt ().compareTo(b.toUBigInt ())
37+ infix fun Long.ushr (b : Short ) = (toUBigInt () ushr b.toUInt()).toLong()
3638
37- infix fun Long.udiv (b : Int ) = (toBigInt () / b.toBigInt ()).toLong()
38- infix fun Long.urem (b : Int ) = (toBigInt () % b.toBigInt ()).toLong()
39- infix fun Long.ucmp (b : Int ) = toBigInt ().compareTo(b.toBigInt ())
39+ infix fun Long.udiv (b : Int ) = (toUBigInt () / b.toUBigInt ()).toLong()
40+ infix fun Long.urem (b : Int ) = (toUBigInt () % b.toUBigInt ()).toLong()
41+ infix fun Long.ucmp (b : Int ) = toUBigInt ().compareTo(b.toUBigInt ())
4042// Long.ushr(b: Int) offered by Kotlin lib
4143
42- infix fun Long.udiv (b : Long ) = (toBigInt () / b.toBigInt ()).toLong()
43- infix fun Long.urem (b : Long ) = (toBigInt () % b.toBigInt ()).toLong()
44- infix fun Long.ucmp (b : Long ) = toBigInt ().compareTo(b.toBigInt ())
44+ infix fun Long.udiv (b : Long ) = (toUBigInt () / b.toUBigInt ()).toLong()
45+ infix fun Long.urem (b : Long ) = (toUBigInt () % b.toUBigInt ()).toLong()
46+ infix fun Long.ucmp (b : Long ) = toUBigInt ().compareTo(b.toUBigInt ())
4547// no Long ushr Long
4648
4749
@@ -53,9 +55,9 @@ infix fun Long.or(b: Ubyte) = this or b.toLong()
5355infix fun Long.xor (b : Ubyte ) = this xor b.toLong()
5456infix fun Long.shl (b : Ubyte ) = this shl b.toInt()
5557
56- infix fun Long.udiv (b : Ubyte ) = (toBigInt () / b.toBigInt()).toLong()
57- infix fun Long.urem (b : Ubyte ) = (toBigInt () % b.toBigInt()).toLong()
58- infix fun Long.ucmp (b : Ubyte ) = toBigInt ().compareTo(b.toBigInt())
58+ infix fun Long.udiv (b : Ubyte ) = (toUBigInt () / b.toBigInt()).toLong()
59+ infix fun Long.urem (b : Ubyte ) = (toUBigInt () % b.toBigInt()).toLong()
60+ infix fun Long.ucmp (b : Ubyte ) = toUBigInt ().compareTo(b.toBigInt())
5961infix fun Long.ushr (b : Ubyte ) = this ushr b.toInt()
6062
6163
@@ -67,10 +69,10 @@ infix fun Long.or(b: Ushort) = this or b.toLong()
6769infix fun Long.xor (b : Ushort ) = this xor b.toLong()
6870infix fun Long.shl (b : Ushort ) = this shl b.toInt()
6971
70- infix fun Long.udiv (b : Ushort ) = (toBigInt () / b.toBigInt()).toLong()
71- infix fun Long.urem (b : Ushort ) = (toBigInt () % b.toBigInt()).toLong()
72- infix fun Long.ucmp (b : Ushort ) = toBigInt ().compareTo(b.toBigInt())
73- infix fun Long.ushr (b : Ushort ) = (toBigInt () ushr b.toInt()).toLong()
72+ infix fun Long.udiv (b : Ushort ) = (toUBigInt () / b.toBigInt()).toLong()
73+ infix fun Long.urem (b : Ushort ) = (toUBigInt () % b.toBigInt()).toLong()
74+ infix fun Long.ucmp (b : Ushort ) = toUBigInt ().compareTo(b.toBigInt())
75+ infix fun Long.ushr (b : Ushort ) = (toUBigInt () ushr b.toInt()).toLong()
7476
7577
7678operator fun Long.plus (b : Uint ) = this + b.v
@@ -81,10 +83,10 @@ infix fun Long.or(b: Uint) = this or b.toLong()
8183infix fun Long.xor (b : Uint ) = this xor b.toLong()
8284infix fun Long.shl (b : Uint ) = this shl b.v
8385
84- infix fun Long.udiv (b : Uint ) = (toBigInt () / b.toBigInt()).toLong()
85- infix fun Long.urem (b : Uint ) = (toBigInt () % b.toBigInt()).toLong()
86- infix fun Long.ucmp (b : Uint ) = toBigInt ().compareTo(b.toBigInt())
87- infix fun Long.ushr (b : Uint ) = (toBigInt () ushr b.toInt()).toLong()
86+ infix fun Long.udiv (b : Uint ) = (toUBigInt () / b.toBigInt()).toLong()
87+ infix fun Long.urem (b : Uint ) = (toUBigInt () % b.toBigInt()).toLong()
88+ infix fun Long.ucmp (b : Uint ) = toUBigInt ().compareTo(b.toBigInt())
89+ infix fun Long.ushr (b : Uint ) = (toUBigInt () ushr b.toInt()).toLong()
8890
8991
9092operator fun Long.plus (b : Ulong ) = this + b.v
@@ -95,7 +97,7 @@ infix fun Long.or(b: Ulong) = this or b.toLong()
9597infix fun Long.xor (b : Ulong ) = this xor b.toLong()
9698infix fun Long.shl (b : Ulong ) = this shl b.toInt()
9799
98- infix fun Long.udiv (b : Ulong ) = (toBigInt () / b.toBigInt()).toLong()
99- infix fun Long.urem (b : Ulong ) = (toBigInt () % b.toBigInt()).toLong()
100- infix fun Long.ucmp (b : Ulong ) = toBigInt ().compareTo(b.toBigInt())
100+ infix fun Long.udiv (b : Ulong ) = (toUBigInt () / b.toBigInt()).toLong()
101+ infix fun Long.urem (b : Ulong ) = (toUBigInt () % b.toBigInt()).toLong()
102+ infix fun Long.ucmp (b : Ulong ) = toUBigInt ().compareTo(b.toBigInt())
101103// no Int ushr Ulong
0 commit comments