Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/js/src/jit-test/lib/   (Firefox Browser Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 2 kB image not shown  

Quelle  dataview.js

  Sprache: JAVA
 

function typeName(typedArrayCtor) {
  return typedArrayCtor.name.slice(0, -"Array".length);
}

const nativeIsLittleEndian = new Uint8Array(new Uint16Array([1]).buffer)[0] === 1;

function toEndianess(type, v, littleEndian) {
  // Disable Ion compilation to call the native, non-inlined DataView functions.
  with ({}); // no-ion
  assertEq(inIon() !== truetrue);

  let dv = new DataView(new ArrayBuffer(type.BYTES_PER_ELEMENT));

  let name = typeName(type);
  dv[`set${name}`](0, v, nativeIsLittleEndian);
  return dv[`get${name}`](0, littleEndian);
}

function toLittleEndian(type, v) {
  return toEndianess(type, v, true);
}

function toBigEndian(type, v) {
  return toEndianess(type, v, false);
}

// Shared test data for various DataView tests.
function createTestData() {
  const tests = [
    {
      type: Int8Array,
      values: [-128, -127, -2, -1012126127],
    },
    {
      type: Uint8Array,
      values: [012126127128254255],
    },
    {
      type: Int16Array,
      values: [-32768, -32767, -2, -10123276632767],
    },
    {
      type: Uint16Array,
      values: [0123276632767327686553465535],
    },
    {
      type: Int32Array,
      values: [-2147483648, -2147483647, -2, -101221474836462147483647],
    },
    {
      type: Uint32Array,
      values: [01221474836462147483647],  // Representable as Int32
    },
    {
      type: Uint32Array,
      values: [01221474836462147483647214748364842949672944294967295],
    },
    {
      type: Float16Array,
      values: [-NaN, -Infinity, -0.5, -0, +00.5, Infinity, NaN],
    },
    {
      type: Float32Array,
      values: [-NaN, -Infinity, -0.5, -0, +00.5, Infinity, NaN],
    },
    {
      type: Float64Array,
      values: [-NaN, -Infinity, -0.5, -0, +00.5, Infinity, NaN],
    },
    {
      type: BigInt64Array,
      values: [-9223372036854775808n, -9223372036854775807n, -2n, -1n, 0n, 1n, 2n, 9223372036854775806n, 9223372036854775807n],
    },
    {
      type: BigUint64Array,
      values: [0n, 1n, 2n, 9223372036854775806n, 9223372036854775807n, 9223372036854775808n, 18446744073709551614n, 18446744073709551615n],
    },
  ];

  tests.forEach(data => {
    data.littleEndian = data.values.map(v => toLittleEndian(data.type, v));
    data.bigEndian = data.values.map(v => toBigEndian(data.type, v));
  });

  return tests;
}

Messung V0.5 in Prozent
C=96 H=100 G=97

¤ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet am  2026-06-05) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.