- Use array.includes over .indexOf for existence checking.
- Immediate object returns.
- Correct commenting for non JSDoc comments.
- Improve assert messages for failures.
- Move generic reusable code into lib.js
- Moved all helper functions to coverage.js
- Refactor individual cov_*[func_id] objects to coverage[func_id].*
- Write coverage data to its own directory (./build/coverage/coverage_data*)
- Enable/disable coverage logging in do_many_cycles to account for exceptions
- Better naming
- Minor stylistic refactoring
For integer multiplication, direct product of two 32-bit integers in
double precision FP arithmetic yields its higher 53 bits which are
sufficient for higher half of the product, while the lower half may be
computed with `Math.imul()`. A polyfill is provided for < IE 10.
For `floor(log2(n))` where `n` is a 32-bit integer, `31 - Math.clz32(n)`
is an accurate substitute for `v86util.int_log2` and preserves
`int_log2(0) = -1` (should it ever occur).
Problem: transferring ownership of the audio Float32Array buffers from
the speaker adapter to sb16 does not appear to work.
Demo: https://jsbin.com/vilafof/edit?html,js,output
This is probably because:
> the returned AudioBuffer is only valid in the scope of the
> onaudioprocess function.
(https://developer.mozilla.org/en-US/docs/Web/API/AudioProcessingEvent)
and probably because transferring ownership will make the buffer
unreadable in the non-worker thread.
Solution: send data through to the speaker adapter directly using the
bus. The sb16.dac_buffers has been modified to allow shifting out a chunk of
consequtive elements more efficiently.