We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 954c291 commit 51b0c98Copy full SHA for 51b0c98
src/lib/float32_truncate.js
@@ -13,11 +13,9 @@
13
* (e.g. node-webkit) that do not implement Float32Array.prototype.slice
14
*/
15
module.exports = function truncate(float32ArrayIn, len) {
16
- if(Float32Array.slice === undefined) {
17
- var float32ArrayOut = new Float32Array(len);
18
- for(var i = 0; i < len; i++) float32ArrayOut[i] = float32ArrayIn[i];
19
- return float32ArrayOut;
20
- }
21
-
22
- return float32ArrayIn.slice(0, len);
+ // for some reason, ES2015 Float32Array.prototype.slice takes 2x as long...
+ // therefore we aren't checking for its existence
+ var float32ArrayOut = new Float32Array(len);
+ for(var i = 0; i < len; i++) float32ArrayOut[i] = float32ArrayIn[i];
+ return float32ArrayOut;
23
};
0 commit comments