{"size": 1146, "ext": "js", "max_stars_repo_path": "deps/mozjs/src/tests/ecma_6/TypedObject/simd/float32x4shuffle.js", "max_stars_repo_name": "ktrzeciaknubisa/jxcore-binary-packaging", "max_stars_repo_stars_event_min_datetime": "2015-02-11T04:34:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T14:21:47.000Z", "max_issues_repo_path": "deps/mozjs/src/tests/ecma_6/TypedObject/simd/float32x4shuffle.js", "max_issues_repo_name": "ktrzeciaknubisa/jxcore-binary-packaging", "max_issues_repo_issues_event_min_datetime": "2015-02-11T17:14:26.000Z", "max_issues_repo_issues_event_max_datetime": "2021-04-13T09:58:39.000Z", "max_forks_repo_path": "deps/mozjs/src/tests/ecma_6/TypedObject/simd/float32x4shuffle.js", "max_forks_repo_name": "ktrzeciaknubisa/jxcore-binary-packaging", "max_forks_repo_forks_event_min_datetime": "2015-02-12T13:45:46.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-21T05:28:05.000Z"}
{"max_stars_count": 2494, "max_issues_count": 685, "max_forks_count": 442, "avg_line_length": 21.2222222222, "max_line_length": 73, "alphanum_fraction": 0.609947644}
// |reftest| skip-if(!this.hasOwnProperty("SIMD"))
var BUGNUMBER = 946042;
var float32x4 = SIMD.float32x4;
var int32x4 = SIMD.int32x4;

var summary = 'float32x4 shuffle';

function test() {
  print(BUGNUMBER + ": " + summary);

  // FIXME -- Bug 948379: Amend to check for correctness of border cases.

  var a = float32x4(1, 2, 3, 4);
  var c = SIMD.float32x4.shuffle(a, 0x1B);
  assertEq(c.x, 4);
  assertEq(c.y, 3);
  assertEq(c.z, 2);
  assertEq(c.w, 1);

  var d = SIMD.float32x4.shuffle(a, 0xFF);
  assertEq(d.x, 4);
  assertEq(d.y, 4);
  assertEq(d.z, 4);
  assertEq(d.w, 4);

  var d = SIMD.float32x4.shuffle(a, 0x0);
  assertEq(d.x, 1);
  assertEq(d.y, 1);
  assertEq(d.z, 1);
  assertEq(d.w, 1);

  var caught = false;
  try {
      var _ = SIMD.float32x4.shuffle(a, 0xFF + 1);
  } catch (e) {
      caught = true;
  }
  assertEq(caught, true, "Mask can't be more than 0xFF");

  var caught = false;
  try {
      var _ = SIMD.float32x4.shuffle(a, -1);
  } catch (e) {
      caught = true;
  }
  assertEq(caught, true, "Mask can't be less than 0");

  if (typeof reportCompare === "function")
    reportCompare(true, true);
}

test();

