Skip to content

Commit ba15ac8

Browse files
committed
Make sure numBytes are integer
Probably it is hard to see in the wild that we use floating-point numbers for numBytes in randomFileContents, which is changed in 6215add. This patch ensures that numBytes are integers.
1 parent 6215add commit ba15ac8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

generators/async-file-system.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const isLittleEndian = computeIsLittleEndian();
3838
async function *randomFileContents() {
3939
let counter = 1;
4040
while(true) {
41-
const numBytes = ((counter * 1192.18851371) % 2056);
41+
const numBytes = (((counter * 1192.18851371) | 0) % 2056);
4242
counter++;
4343
let result = new ArrayBuffer(numBytes);
4444
let view = new Uint8Array(result);

generators/sync-file-system.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const isLittleEndian = computeIsLittleEndian();
3838
function *randomFileContents() {
3939
let counter = 1;
4040
while(true) {
41-
const numBytes = ((counter * 1192.18851371) % 2056);
41+
const numBytes = (((counter * 1192.18851371) | 0) % 2056);
4242
counter++;
4343
let result = new ArrayBuffer(numBytes);
4444
let view = new Uint8Array(result);

0 commit comments

Comments
 (0)