Skip to content

Commit 9b180ad

Browse files
committed
*Array.toBuffer()
1 parent d7c99ec commit 9b180ad

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,55 +5,55 @@ import glm_.size
55
import org.lwjgl.system.MemoryUtil
66
import java.nio.*
77

8-
fun FloatArray.toFloatBuf(): FloatBuffer {
8+
fun FloatArray.toFloatBuffer(): FloatBuffer {
99
val res = MemoryUtil.memAllocFloat(size)
1010
for (i in 0 until size) res.put(i, this[i])
1111
return res
1212
}
1313

14-
fun FloatArray.toBuf(): ByteBuffer {
14+
fun FloatArray.toBuffer(): ByteBuffer {
1515
val res = MemoryUtil.memAlloc(size * Float.BYTES)
1616
for (i in 0 until size) res.putFloat(i * Float.BYTES, this[i])
1717
return res
1818
}
1919

20-
fun DoubleArray.toDoubleBuf(): DoubleBuffer {
20+
fun DoubleArray.toDoubleBuffer(): DoubleBuffer {
2121
val res = MemoryUtil.memAllocDouble(size)
2222
for (i in 0 until size) res.put(i, this[i])
2323
return res
2424
}
2525

26-
fun DoubleArray.toBuf(): ByteBuffer {
26+
fun DoubleArray.toBuffer(): ByteBuffer {
2727
val res = MemoryUtil.memAlloc(size * Double.BYTES)
2828
for (i in 0 until size) res.putDouble(i * Double.BYTES, this[i])
2929
return res
3030
}
3131

32-
fun ByteArray.toBuf(): ByteBuffer {
32+
fun ByteArray.toBuffer(): ByteBuffer {
3333
val res = MemoryUtil.memAlloc(size)
3434
for (i in 0 until size) res.put(i, this[i])
3535
return res
3636
}
3737

38-
fun ShortArray.toShortBuf(): ShortBuffer {
38+
fun ShortArray.toShortBuffer(): ShortBuffer {
3939
val res = MemoryUtil.memAllocShort(size)
4040
for (i in 0 until size) res.put(i, this[i])
4141
return res
4242
}
4343

44-
fun ShortArray.toBuf(): ByteBuffer {
44+
fun ShortArray.toBuffer(): ByteBuffer {
4545
val res = MemoryUtil.memAlloc(size * Short.BYTES)
4646
for (i in 0 until size) res.putShort(i * Short.BYTES, this[i])
4747
return res
4848
}
4949

50-
fun IntArray.toIntBuf(): IntBuffer {
50+
fun IntArray.toIntBuffer(): IntBuffer {
5151
val res = MemoryUtil.memAllocInt(size)
5252
for (i in 0 until size) res.put(i, this[i])
5353
return res
5454
}
5555

56-
fun IntArray.toBuf(): ByteBuffer {
56+
fun IntArray.toBuffer(): ByteBuffer {
5757
val res = MemoryUtil.memAlloc(size * Int.BYTES)
5858
for (i in 0 until size) res.putInt(i * Int.BYTES, this[i])
5959
return res
@@ -65,7 +65,7 @@ fun LongArray.toLongBuffer(): LongBuffer {
6565
return res
6666
}
6767

68-
fun LongArray.toBuf(): ByteBuffer {
68+
fun LongArray.toBuffer(): ByteBuffer {
6969
val res = MemoryUtil.memAlloc(size * Long.BYTES)
7070
for (i in 0 until size) res.putLong(i * Long.BYTES, this[i])
7171
return res

0 commit comments

Comments
 (0)