# All files / src types.js

100% Statements 8/8
100% Branches 6/6
100% Functions 1/1
100% Lines 8/8

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    23x

    23x
    3246x

    2537x

    99x

    264x

    70x

    276x

     // @flow
    export const sizes = {
      i64: 8,
      f64: 8,
      i32: 4,
      f32: 4,
    };

    export const typeWeight = (typeString: ?string): number => {
      switch (typeString) {
        case 'i32':
        case 'bool':
          return 0;
        case 'i64':
          return 1;
        case 'f32':
          return 2;
        case 'f64':
          return 3;
        default:
          return -1;
      }
    };