How to use @webassemblyjs/floating-point-hex-parser - 4 common examples

To help you get started, we’ve selected a few @webassemblyjs/floating-point-hex-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zc910704 / Vue.js-personal-note / www / day6.1.webpack的url-loader与babel / node_modules / @webassemblyjs / wast-parser / esm / number-literals.js View on Github external
export function parse32F(sourceString) {
  if (isHexLiteral(sourceString)) {
    return parseHexFloat(sourceString);
  }

  if (isInfLiteral(sourceString)) {
    return sourceString[0] === "-" ? -1 : 1;
  }

  if (isNanLiteral(sourceString)) {
    return (sourceString[0] === "-" ? -1 : 1) * (sourceString.includes(":") ? parseInt(sourceString.substring(sourceString.indexOf(":") + 1), 16) : 0x400000);
  }

  return parseFloat(sourceString);
}
export function parse64F(sourceString) {
github xtuc / webassemblyjs / packages / wast-parser / src / number-literals.js View on Github external
if (isHexLiteral(sourceString)) {
    return parseHexFloat(sourceString);
  }
  if (isInfLiteral(sourceString)) {
    return sourceString[0] === "-" ? -1 : 1;
  }
  if (isNanLiteral(sourceString)) {
    return (
      (sourceString[0] === "-" ? -1 : 1) *
      (sourceString.includes(":")
        ? parseInt(sourceString.substring(sourceString.indexOf(":") + 1), 16)
        : 0x8000000000000)
    );
  }
  if (isHexLiteral(sourceString)) {
    return parseHexFloat(sourceString);
  }
  return parseFloat(sourceString);
}
github xtuc / webassemblyjs / packages / wast-parser / src / number-literals.js View on Github external
export function parse32F(sourceString: string): number {
  if (isHexLiteral(sourceString)) {
    return parseHexFloat(sourceString);
  }
  if (isInfLiteral(sourceString)) {
    return sourceString[0] === "-" ? -1 : 1;
  }
  if (isNanLiteral(sourceString)) {
    return (
      (sourceString[0] === "-" ? -1 : 1) *
      (sourceString.includes(":")
        ? parseInt(sourceString.substring(sourceString.indexOf(":") + 1), 16)
        : 0x400000)
    );
  }
  return parseFloat(sourceString);
}
github zc910704 / Vue.js-personal-note / www / day6.1.webpack的url-loader与babel / node_modules / @webassemblyjs / wast-parser / esm / number-literals.js View on Github external
export function parse64F(sourceString) {
  if (isHexLiteral(sourceString)) {
    return parseHexFloat(sourceString);
  }

  if (isInfLiteral(sourceString)) {
    return sourceString[0] === "-" ? -1 : 1;
  }

  if (isNanLiteral(sourceString)) {
    return (sourceString[0] === "-" ? -1 : 1) * (sourceString.includes(":") ? parseInt(sourceString.substring(sourceString.indexOf(":") + 1), 16) : 0x8000000000000);
  }

  if (isHexLiteral(sourceString)) {
    return parseHexFloat(sourceString);
  }

  return parseFloat(sourceString);
}

@webassemblyjs/floating-point-hex-parser

A function to parse floating point hexadecimal strings as defined by the WebAssembly specification

MIT
Latest version published 2 months ago

Package Health Score

88 / 100
Full package analysis

Popular @webassemblyjs/floating-point-hex-parser functions