Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / regress / script-tests / Int8Array-load.js
blobc32663bb7591a3c87cf9896259f3a96c30a7bb0e
1 // Test the performance of Int8Array by implementing Adler32.
3 function adler32(array)
5 var MOD_ADLER = 65521;
6 var a = 1;
7 var b = 0;
8 var index;
10 /* Process each byte of the data in order */
11 for (index = 0; index < array.length; ++index)
13 a = (a + array[index]) % MOD_ADLER;
14 b = (b + a) % MOD_ADLER;
17 return (b << 16) | a;
20 var array = new Int8Array(1000);
21 for (var i = 0; i < array.length ; ++i)
22 array[i] = i;
24 var result = 0;
25 for (var i = 0; i < 300; ++i)
26 result += adler32(array);
28 if (result != -63300)
29 throw "Bad result: " + result;