@@ -34,6 +34,10 @@ inline class BytePtr(val adr: Adr) {
34
34
35
35
inline operator fun plus (offset : Int ): BytePtr = BytePtr (adr + offset * Byte .BYTES )
36
36
// inline operator fun plus(pByte: BytePtr): BytePtr = BytePtr(adr + pByte.adr)
37
+
38
+ companion object {
39
+ val NULL get() = BytePtr (MemoryUtil .NULL )
40
+ }
37
41
}
38
42
39
43
inline fun BytePtr (intPtr : IntPtr ) = BytePtr (intPtr.adr)
@@ -61,6 +65,10 @@ inline class ShortPtr(val adr: Adr) {
61
65
inline operator fun invoke (): Short = UNSAFE .getShort(null , adr)
62
66
63
67
inline operator fun plus (offset : Int ): ShortPtr = ShortPtr (adr + offset * Short .BYTES )
68
+
69
+ companion object {
70
+ val NULL get() = ShortPtr (MemoryUtil .NULL )
71
+ }
64
72
}
65
73
66
74
inline fun ShortPtr (bytePtr : BytePtr ) = ShortPtr (bytePtr.adr)
@@ -83,6 +91,10 @@ inline class IntPtr(val adr: Adr) {
83
91
inline operator fun invoke (): Int = UNSAFE .getInt(null , adr)
84
92
85
93
inline operator fun plus (offset : Int ): IntPtr = IntPtr (adr + offset * Int .BYTES )
94
+
95
+ companion object {
96
+ val NULL get() = IntPtr (MemoryUtil .NULL )
97
+ }
86
98
}
87
99
88
100
inline fun IntPtr (bytePtr : BytePtr ) = IntPtr (bytePtr.adr)
@@ -106,6 +118,10 @@ inline class LongPtr(val adr: Adr) {
106
118
inline operator fun invoke (): Long = UNSAFE .getLong(null , adr)
107
119
108
120
inline operator fun plus (offset : Int ): LongPtr = LongPtr (adr + offset * Long .BYTES )
121
+
122
+ companion object {
123
+ val NULL get() = LongPtr (MemoryUtil .NULL )
124
+ }
109
125
}
110
126
111
127
inline fun LongPtr (bytePtr : BytePtr ) = LongPtr (bytePtr.adr)
@@ -129,6 +145,10 @@ inline class FloatPtr(val adr: Adr) {
129
145
inline operator fun invoke (): Float = UNSAFE .getFloat(null , adr)
130
146
131
147
inline operator fun plus (offset : Int ): FloatPtr = FloatPtr (adr + offset * Float .BYTES )
148
+
149
+ companion object {
150
+ val NULL get() = FloatPtr (MemoryUtil .NULL )
151
+ }
132
152
}
133
153
134
154
inline fun FloatPtr (bytePtr : BytePtr ) = FloatPtr (bytePtr.adr)
@@ -152,6 +172,10 @@ inline class DoublePtr(val adr: Adr) {
152
172
inline operator fun invoke (): Double = UNSAFE .getDouble(null , adr)
153
173
154
174
inline operator fun plus (offset : Int ): DoublePtr = DoublePtr (adr + offset * Double .BYTES )
175
+
176
+ companion object {
177
+ val NULL get() = DoublePtr (MemoryUtil .NULL )
178
+ }
155
179
}
156
180
157
181
inline fun DoublePtr (bytePtr : BytePtr ) = DoublePtr (bytePtr.adr)
@@ -177,6 +201,10 @@ inline class PointerPtr(val adr: Adr) {
177
201
inline operator fun invoke (): Ptr = UNSAFE .getLong(null , adr)
178
202
179
203
inline operator fun plus (offset : Int ): PointerPtr = PointerPtr (adr + offset * Long .BYTES )
204
+
205
+ companion object {
206
+ val NULL get() = PointerPtr (MemoryUtil .NULL )
207
+ }
180
208
}
181
209
182
210
inline fun PointerPtr (bytePtr : BytePtr ) = PointerPtr (bytePtr.adr)
0 commit comments