diff options
-rw-r--r-- | src/library.js | 2 | ||||
-rw-r--r-- | src/library_openal.js | 20 | ||||
-rwxr-xr-x | tests/runner.py | 2 |
3 files changed, 15 insertions, 9 deletions
diff --git a/src/library.js b/src/library.js index d5f11cf3..793a78d7 100644 --- a/src/library.js +++ b/src/library.js @@ -4950,7 +4950,7 @@ LibraryManager.library = { var ret = 0; while (x) { if (x&1) ret++; - x >>= 1; + x >>>= 1; } return ret; }, diff --git a/src/library_openal.js b/src/library_openal.js index 6bd0f6b0..271ae5ae 100644 --- a/src/library_openal.js +++ b/src/library_openal.js @@ -385,14 +385,18 @@ var LibraryOpenAL = { return; } var offset = 0; - if ("src" in AL.currentContext.src[source - 1]) { - // If the source is already playing, we need to resume from beginning. - // We do that by stopping the current source and replaying it. - _alSourceStop(source); - } else if (AL.currentContext.src[source - 1].paused) { - // So now we have to resume playback, remember the offset here. - offset = AL.currentContext.src[source - 1].pausedTime - - AL.currentContext.src[source - 1].playTime; + if ("src" in AL.currentContext.src[source - 1] && + AL.currentContext.src[source - 1]["src"].buffer == + AL.currentContext.src[source - 1].buffer) { + if (AL.currentContext.src[source - 1].paused) { + // So now we have to resume playback, remember the offset here. + offset = AL.currentContext.src[source - 1].pausedTime - + AL.currentContext.src[source - 1].playTime; + } else { + // If the source is already playing, we need to resume from beginning. + // We do that by stopping the current source and replaying it. + _alSourceStop(source); + } } var src = AL.currentContext.ctx.createBufferSource(); src.loop = AL.currentContext.src[source - 1].loop; diff --git a/tests/runner.py b/tests/runner.py index 529dcc48..d375d2f7 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -1269,6 +1269,7 @@ m_divisor is 1091269979 printf("%d,%d\n", (int)llvm_ctlz_i64(((int64_t)1) << 40), llvm_ctlz_i32(1<<10)); printf("%d,%d\n", (int)llvm_cttz_i64(((int64_t)1) << 40), llvm_cttz_i32(1<<10)); printf("%d,%d\n", (int)llvm_ctpop_i64((0x3101ULL << 32) | 1), llvm_ctpop_i32(0x3101)); + printf("%d\n", (int)llvm_ctpop_i32(-594093059)); printf("%d\n", llvm_expect_i32(x % 27, 3)); @@ -1286,6 +1287,7 @@ c5,de,15,8a 23,21 40,10 5,4 +22 13 72057594037927936 ''') |