tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

bug1000605.js (1026B)


      1 setJitCompilerOption("baseline.warmup.trigger", 0);
      2 setJitCompilerOption("ion.warmup.trigger", 0);
      3 
      4 function ceil(a, b) {
      5    return Math.ceil((a | 0) / (b | 0)) | 0;
      6 }
      7 function floor(a, b) {
      8    return Math.floor((a | 0) / (b | 0)) | 0;
      9 }
     10 function round(a, b) {
     11    return Math.round((a | 0) / (b | 0)) | 0;
     12 }
     13 function intdiv(a, b) {
     14    return ((a | 0) / (b | 0)) | 0;
     15 }
     16 
     17 // Always rounds up.
     18 assertEq(ceil(5, 5), 1);
     19 assertEq(ceil(4, 3), 2);
     20 assertEq(ceil(5, 3), 2);
     21 assertEq(ceil(-4, 3), -1);
     22 assertEq(ceil(-5, 3), -1);
     23 
     24 // Always rounds down.
     25 assertEq(floor(5, 5), 1);
     26 assertEq(floor(4, 3), 1);
     27 assertEq(floor(5, 3), 1);
     28 assertEq(floor(-4, 3), -2);
     29 assertEq(floor(-5, 3), -2);
     30 
     31 // Always rounds towards the nearest.
     32 assertEq(round(5, 5), 1);
     33 assertEq(round(4, 3), 1);
     34 assertEq(round(5, 3), 2);
     35 assertEq(round(-4, 3), -1);
     36 assertEq(round(-5, 3), -2);
     37 
     38 // Always rounds towards zero.
     39 assertEq(intdiv(5, 5), 1);
     40 assertEq(intdiv(4, 3), 1);
     41 assertEq(intdiv(5, 3), 1);
     42 assertEq(intdiv(-4, 3), -1);
     43 assertEq(intdiv(-5, 3), -1);