1
+ package unsigned
2
+
3
+
4
+ fun UbyteArray (size : Int ) = UbyteArray (ByteArray (size))
5
+ fun UbyteArray (size : Int , init : (Int ) -> Byte ) = UbyteArray (ByteArray (size, init ))
6
+
7
+ inline class UbyteArray (val data : ByteArray ) {
8
+
9
+ operator fun get (index : Int ) = Ubyte (data[index])
10
+
11
+ operator fun set (index : Int , value : Ubyte ) {
12
+ data[index] = value.v
13
+ }
14
+ }
15
+
16
+
17
+ fun UshortArray (size : Int ) = UshortArray (ShortArray (size))
18
+ fun UshortArray (size : Int , init : (Int ) -> Short ) = UshortArray (ShortArray (size, init ))
19
+
20
+ inline class UshortArray (val data : ShortArray ) {
21
+
22
+ operator fun get (index : Int ) = Ushort (data[index])
23
+
24
+ operator fun set (index : Int , value : Ushort ) {
25
+ data[index] = value.v
26
+ }
27
+ }
28
+
29
+
30
+ fun UintArray (size : Int ) = UintArray (IntArray (size))
31
+ fun UintArray (size : Int , init : (Int ) -> Int ) = UintArray (IntArray (size, init ))
32
+
33
+ inline class UintArray (val data : IntArray ) {
34
+
35
+ operator fun get (index : Int ) = Uint (data[index])
36
+
37
+ operator fun set (index : Int , value : Uint ) {
38
+ data[index] = value.v
39
+ }
40
+ }
41
+
42
+ fun UlongArray (size : Int ) = UlongArray (LongArray (size))
43
+ fun UlongArray (size : Int , init : (Int ) -> Long ) = UlongArray (LongArray (size, init ))
44
+
45
+ inline class UlongArray (val data : LongArray ) {
46
+
47
+ operator fun get (index : Int ) = Ulong (data[index])
48
+
49
+ operator fun set (index : Int , value : Ulong ) {
50
+ data[index] = value.v
51
+ }
52
+ }
0 commit comments