Index: test/mjsunit/asm/uint32div.js |
diff --git a/test/mjsunit/asm/uint32div.js b/test/mjsunit/asm/uint32div.js |
index 54a2138786692ebf24e7e3e7d21cda2879e39952..dcbb73bfa9e45e16dbd9c8accf8de10e8b1193c4 100644 |
--- a/test/mjsunit/asm/uint32div.js |
+++ b/test/mjsunit/asm/uint32div.js |
@@ -22,8 +22,24 @@ function Uint32Div(divisor) { |
var divisors = [0, 1, 3, 4, 10, 42, 64, 100, 1024, 2147483647, 4294967295]; |
for (var i in divisors) { |
var divisor = divisors[i]; |
- var mod = Uint32Div(divisor); |
+ var div = Uint32Div(divisor); |
for (var dividend = 0; dividend < 4294967296; dividend += 3999773) { |
- assertEquals((dividend / divisor) >>> 0, mod(dividend)); |
+ assertEquals((dividend / divisor) >>> 0, div(dividend)); |
+ } |
+} |
+ |
+var div = (function(stdlib, foreign, heap) { |
+ "use asm"; |
+ function div(dividend, divisor) { |
+ return (dividend >>> 0) / (divisor >>> 0) | 0; |
+ } |
+ return {div: div}; |
+})(stdlib, foreign, heap).div; |
+ |
+for (var i in divisors) { |
+ var divisor = divisors[i]; |
+ for (var dividend = 0; dividend < 4294967296; dividend += 3999773) { |
+ assertEquals((dividend >>> 0) / (divisor >>> 0) | 0, |
+ div(dividend, divisor)); |
} |
} |