From 95aca4b4d8fa62815d4bd412fff1a364f842814a Mon Sep 17 00:00:00 2001 From: Ryan Johnson Date: Thu, 29 Apr 2021 16:16:42 -0700 Subject: remove retired locales (#699) --- .../reference/global_objects/math/clz32/index.html | 156 --------------------- 1 file changed, 156 deletions(-) delete mode 100644 files/ca/web/javascript/reference/global_objects/math/clz32/index.html (limited to 'files/ca/web/javascript/reference/global_objects/math/clz32/index.html') diff --git a/files/ca/web/javascript/reference/global_objects/math/clz32/index.html b/files/ca/web/javascript/reference/global_objects/math/clz32/index.html deleted file mode 100644 index 74c1cecef7..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/clz32/index.html +++ /dev/null @@ -1,156 +0,0 @@ ---- -title: Math.clz32() -slug: Web/JavaScript/Reference/Global_Objects/Math/clz32 -translation_of: Web/JavaScript/Reference/Global_Objects/Math/clz32 -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/clz32 ---- -
{{JSRef}}
- -

La funció Math.clz32() retorna el nombre de zeros a l'esquerra que apareixen en una representació binària de 32 bits per a un nombre.

- -

Sintaxi

- -
Math.clz32(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

"clz32" és una abreviació de CountLeadingZeroes32.

- -

Si x no és un nombre, primer es convertirà a un nombre, i després es convertirà a un nombre sencer de 32 bits sense signe.

- -

Si el nombre sencer sense signe de 32 bits és 0, la funció retornarà 32 ja que tots els bits són 0.

- -

Aquesta funció és particulament útil per a sistemes que compilin en JavaScript, com ara Emscripten.

- -

Exemples

- -

Utilitzar Math.clz32()

- -
Math.clz32(1);                // 31
-Math.clz32(1000);             // 22
-Math.clz32();                 // 32
-
-[NaN, Infinity, -Infinity, 0, -0, null, undefined, 'foo', {}, []].filter(
-function(n) {
-  return Math.clz32(n) !== 32
-});                           // []
-
-Math.clz32(true);             // 31
-Math.clz32(3.5);              // 30
-
- -

Polyfill

- -

Aquesta funció polyfill utilitza {{jsxref("Math.imul")}}.

- -
Math.clz32 = Math.clz32 || (function () {
-  'use strict';
-
-  var table = [
-    32, 31,  0, 16,  0, 30,  3,  0, 15,  0,  0,  0, 29, 10,  2,  0,
-     0,  0, 12, 14, 21,  0, 19,  0,  0, 28,  0, 25,  0,  9,  1,  0,
-    17,  0,  4,   ,  0,  0, 11,  0, 13, 22, 20,  0, 26,  0,  0, 18,
-     5,  0,  0, 23,  0, 27,  0,  6,  0, 24,  7,  0,  8,  0,  0,  0]
-
-  // Adaptat d'un algorisme trobat a Hacker's Delight, pàgina 103.
-  return function (x) {
-    // Tingueu en compte que les variables no tenen perquè ser les mateixes.
-
-    // 1. On n = ToUint32(x).
-    var v = Number(x) >>> 0
-
-    // 2. On p és el nombre de zeros a l'esquerra en la representació binària de 32 bits de n.
-    v |= v >>> 1
-    v |= v >>> 2
-    v |= v >>> 4
-    v |= v >>> 8
-    v |= v >>> 16
-    v = table[Math.imul(v, 0x06EB14F9) >>> 26]
-
-    // Retorna p.
-    return v
-  }
-})();
-
- -

Especificacions

- - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES6', '#sec-math.clz32', 'Math.clz32')}}{{Spec2('ES6')}}Definició inicial.
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("38")}}{{CompatGeckoDesktop("31")}}{{CompatNo}}{{CompatOpera("25")}}{{CompatNo}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile("31")}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
-
- -

Vegeu també

- - -- cgit v1.2.3-54-g00ecf