문제

I've this raw data:

var x = [25];
var y = [0.004011332988739014, 0.0027810593601316214, 0.0015301937237381935, 0.0009717916836962104];

And I want to put them into this ArrayBuffer:

var buff = new ArrayBuffer(24);
var f64s = new Float64Array(h, 0, 1);
var f32s = new Float32Array(h, 1 * 4);

I can fill data into Float32Array with this method:

f32s.set(y)

How do I set value of array x into Float64Array with methods similar to above. So I can get something like this:

new ArrayBuffer([25, 0.004011332988739014, 0.0027810593601316214, 0.0015301937237381935, 0.0009717916836962104]);

Thank you,

도움이 되었습니까?

해결책

var f64s = new Float64Array(x.length + y.length);
f64s.set(x, 0);
f64s.set(y, x.length);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top