<commit_before>package uno.buffer

import com.jogamp.opengl.util.GLBuffers
import main.BYTES
import java.nio.*

/**
 * Created by elect on 05/03/17.
 */


fun FloatBuffer.put(vararg floats: Float) = floats.forEachIndexed { i, f -> put(i, f) }


fun FloatArray.toFloatBuffer(): FloatBuffer = GLBuffers.newDirectFloatBuffer(this)
fun FloatArray.toByteBuffer(): ByteBuffer {
    val res = byteBufferBig(size * Float.BYTES)
    forEachIndexed { i, float -> res.putFloat(i * Float.BYTES, float) }
    return res
}

fun DoubleArray.toDoubleBuffer(): DoubleBuffer = GLBuffers.newDirectDoubleBuffer(this)
fun DoubleArray.toByteBuffer(): ByteBuffer {
    val res = byteBufferBig(size * Double.BYTES)
    forEachIndexed { i, double -> res.putDouble(i * Double.BYTES, double) }<commit_msg>- fixed return<commit_after>package uno.buffer

import com.jogamp.opengl.util.GLBuffers
import main.BYTES
import java.nio.*

/**
 * Created by elect on 05/03/17.
 */


fun FloatBuffer.put(vararg floats: Float): FloatBuffer {
    floats.forEachIndexed { i, f -> put(i, f) }
    return this
}


fun FloatArray.toFloatBuffer(): FloatBuffer = GLBuffers.newDirectFloatBuffer(this)
fun FloatArray.toByteBuffer(): ByteBuffer {
    val res = byteBufferBig(size * Float.BYTES)
    forEachIndexed { i, float -> res.putFloat(i * Float.BYTES, float) }
    return res
}

fun DoubleArray.toDoubleBuffer(): DoubleBuffer = GLBuffers.newDirectDoubleBuffer(this)
fun DoubleArray.toByteBuffer(): ByteBuffer {
    val res = byteBufferBig(size * Double.BYTES)
    forEachIndexed { i, double -> res.putDouble(i * Double.BYTES, double) }
{'fraction_non_alphanumeric': 0.1199748743718593, 'fraction_numerical': 0.007537688442211055, 'mean_word_length': 4.381756756756757, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4212994', 'n_tokens_mistral': 535, 'n_tokens_neox': 514, 'n_words': 121}