LCOV - code coverage report
Current view: top level - randomjs/distribution - uint53Full.ts (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 6 19 31.6 %
Date: 2021-03-12 10:43:40 Functions: 0 1 0.0 %

          Line data    Source code
       1             : import { Engine } from "../types.ts";
       2           1 : import {
       3           1 :   SMALLEST_UNSAFE_INTEGER,
       4           1 :   UINT21_MAX,
       5           1 :   UINT21_SIZE,
       6           1 :   UINT32_SIZE
       7           1 : } from "../utils/constants.ts";
       8             : 
       9             : /**
      10             :  * Returns a value within [0, 0x20000000000000]
      11             :  */
      12           0 : export function uint53Full(engine: Engine): number {
      13           0 :   while (true) {
      14           0 :     const high = engine.next() | 0;
      15           0 :     if (high & UINT21_SIZE) {
      16           0 :       if ((high & UINT21_MAX) === 0 && (engine.next() | 0) === 0) {
      17           0 :         return SMALLEST_UNSAFE_INTEGER;
      18           0 :       }
      19           0 :     } else {
      20           0 :       const low = engine.next() >>> 0;
      21           0 :       return (high & UINT21_MAX) * UINT32_SIZE + low;
      22           0 :     }
      23           0 :   }
      24           0 : }

Generated by: LCOV version 1.15