(f)
| 2482 | } |
| 2483 | |
| 2484 | function wasmS128Const(f) { |
| 2485 | // Write in little-endian order at offset 0. |
| 2486 | if (Array.isArray(f)) { |
| 2487 | if (f.length != 16) throw new Error('S128Const needs 16 bytes'); |
| 2488 | return [kSimdPrefix, kExprS128Const, ...f]; |
| 2489 | } |
| 2490 | let result = [kSimdPrefix, kExprS128Const]; |
| 2491 | if (arguments.length === 2) { |
| 2492 | for (let j = 0; j < 2; j++) { |
| 2493 | data_view.setFloat64(0, arguments[j], true); |
| 2494 | for (let i = 0; i < 8; i++) result.push(byte_view[i]); |
| 2495 | } |
| 2496 | } else if (arguments.length === 4) { |
| 2497 | for (let j = 0; j < 4; j++) { |
| 2498 | data_view.setFloat32(0, arguments[j], true); |
| 2499 | for (let i = 0; i < 4; i++) result.push(byte_view[i]); |
| 2500 | } |
| 2501 | } else { |
| 2502 | throw new Error('S128Const needs an array of bytes, or two f64 values, ' + |
| 2503 | 'or four f32 values'); |
| 2504 | } |
| 2505 | return result; |
| 2506 | } |
| 2507 | |
| 2508 | let wasmEncodeHeapType = function(type) { |
| 2509 | let result = wasmSignedLeb(type.heap_type, kMaxVarInt32Size); |
no test coverage detected