Skip to content

Commit 6ddefc0

Browse files
committed
fun CharArray.toBuffer()
1 parent 3c30ef3 commit 6ddefc0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main/kotlin/uno/buffer/extensions.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package uno.buffer
22

3-
import glm_.BYTES
4-
import glm_.size
3+
import glm_.*
54
import org.lwjgl.system.MemoryUtil
65
import java.nio.*
76

@@ -70,4 +69,10 @@ fun LongArray.toBuffer(): ByteBuffer {
7069
val res = MemoryUtil.memAlloc(size * Long.BYTES)
7170
for (i in 0 until size) res.putLong(i * Long.BYTES, this[i])
7271
return res
72+
}
73+
74+
fun CharArray.toBuffer(): ByteBuffer {
75+
val res = MemoryUtil.memAlloc(size * Byte.BYTES)
76+
for (i in 0 until size) res[i * Byte.BYTES] = this[i].b
77+
return res
7378
}

0 commit comments

Comments
 (0)