diff options
author | Ryan Johnson <rjohnson@mozilla.com> | 2021-04-29 16:16:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-29 16:16:42 -0700 |
commit | 95aca4b4d8fa62815d4bd412fff1a364f842814a (patch) | |
tree | 5e57661720fe9058d5c7db637e764800b50f9060 /files/ca/web/javascript/reference/global_objects/math/clz32/index.html | |
parent | ee3b1c87e3c8e72ca130943eed260ad642246581 (diff) | |
download | translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.tar.gz translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.tar.bz2 translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.zip |
remove retired locales (#699)
Diffstat (limited to 'files/ca/web/javascript/reference/global_objects/math/clz32/index.html')
-rw-r--r-- | files/ca/web/javascript/reference/global_objects/math/clz32/index.html | 156 |
1 files changed, 0 insertions, 156 deletions
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 ---- -<div>{{JSRef}}</div> - -<p>La funció <strong><code>Math.clz32()</code></strong> retorna el nombre de zeros a l'esquerra que apareixen en una representació binària de 32 bits per a un nombre.</p> - -<h2 id="Sintaxi">Sintaxi</h2> - -<pre class="syntaxbox"><code>Math.clz32(<var>x</var>)</code></pre> - -<h3 id="Paràmetres">Paràmetres</h3> - -<dl> - <dt><code>x</code></dt> - <dd>Un nombre.</dd> -</dl> - -<h2 id="Descripció">Descripció</h2> - -<p>"<code>clz32</code>" és una abreviació de <code>CountLeadingZeroes32</code>.</p> - -<p>Si <code>x</code> no és un nombre, primer es convertirà a un nombre, i després es convertirà a un nombre sencer de 32 bits sense signe.</p> - -<p>Si el nombre sencer sense signe de 32 bits és <code>0</code>, la funció retornarà <code>32</code> ja que tots els bits són <code>0</code>.</p> - -<p>Aquesta funció és particulament útil per a sistemes que compilin en JavaScript, com ara <a href="/en-US/docs/Emscripten">Emscripten</a>.</p> - -<h2 id="Exemples">Exemples</h2> - -<h3 id="Utilitzar_Math.clz32()">Utilitzar <code>Math.clz32()</code></h3> - -<pre class="brush: js">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 -</pre> - -<h2 id="Polyfill">Polyfill</h2> - -<p>Aquesta funció polyfill utilitza {{jsxref("Math.imul")}}.</p> - -<pre class="brush: js">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 - } -})(); -</pre> - -<h2 id="Especificacions">Especificacions</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Especificació</th> - <th scope="col">Estat</th> - <th scope="col">Comentaris</th> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-math.clz32', 'Math.clz32')}}</td> - <td>{{Spec2('ES6')}}</td> - <td>Definició inicial.</td> - </tr> - </tbody> -</table> - -<h2 id="Compatibilitat_amb_navegadors">Compatibilitat amb navegadors</h2> - -<div>{{CompatibilityTable}}</div> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Característica</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Suport bàsic</td> - <td>{{CompatChrome("38")}}</td> - <td>{{CompatGeckoDesktop("31")}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatOpera("25")}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Característica</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Suport bàsic</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatGeckoMobile("31")}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<h2 id="Vegeu_també">Vegeu també</h2> - -<ul> - <li>{{jsxref("Math")}}</li> -</ul> |