Skip to content

Commit

Permalink
Remove power-of-two rounding.
Browse files Browse the repository at this point in the history
  • Loading branch information
manthey committed Oct 30, 2018
1 parent 0a9172d commit 1908381
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/util/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,14 +368,10 @@ var util = {
}
/* If we need to allocate a new buffer (smaller or larger), and we have an
* existing, non-zero-length buffer, allocate a larger than needed buffer.
* Add an extra factor of allocateLarger, but if a power-of-two is between
* the specified size and the larger permitted size, perfer the power-of-
* two. */
* Add an extra factor of allocateLarger. */
var allocate = len;
if (data instanceof Float32Array && data.length && len && allocateLarger > 0) {
allocate = Math.min(
Math.floor((allocateLarger + 1) * len),
Math.pow(2, Math.ceil(Math.log(len) / Math.log(2))));
allocate = Math.floor((allocateLarger + 1) * len);
}
data = new Float32Array(allocate);
src.setData(data);
Expand Down

0 comments on commit 1908381

Please sign in to comment.