<commit_before>// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Flags: --allow-natives-syntax

var stdlib = { Math: Math };

var f = (function Module(stdlib) {
  "use asm";

  var clz32 = stdlib.Math.clz32;

  function f(a) {
    a = a >>> 0;
    return clz32(a)|0;
  }

  return f;
})(stdlib);

assertEquals(32, f(0));
assertEquals(32, f(NaN));
assertEquals(32, f(undefined));
for (var i = 0; i < 32; ++i) {
  assertEquals(i, f((-1) >>> i));
}
for (var i = -2147483648; i < 2147483648; i += 3999773) {
  assertEquals(%MathClz32(i), f(i));
  assertEquals(%_MathClz32(i), f(i));
}<commit_msg>[turbofan] Fix test of %_MathClz32 intrinsic.<commit_after>// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Flags: --allow-natives-syntax

var stdlib = { Math: Math };

var f = (function Module(stdlib) {
  "use asm";

  var clz32 = stdlib.Math.clz32;

  function f(a) {
    a = a >>> 0;
    return clz32(a)|0;
  }

  return f;
})(stdlib);

assertEquals(32, f(0));
assertEquals(32, f(NaN));
assertEquals(32, f(undefined));
for (var i = 0; i < 32; ++i) {
  assertEquals(i, f((-1) >>> i));
}
for (var i = -2147483648; i < 2147483648; i += 3999773) {
  assertEquals(%MathClz32(i), f(i));
  assertEquals(%MathClz32(i), %_MathClz32(i >>> 0));
}
{'fraction_non_alphanumeric': 0.17515274949083504, 'fraction_numerical': 0.07807196198234895, 'mean_word_length': 3.6206896551724137, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6621928', 'n_tokens_mistral': 636, 'n_tokens_neox': 551, 'n_words': 170}