mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-12-15 23:37:25 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
<h2 id="Summary" name="Summary">概述</h2>
|
||||
<p><code><strong>Math.clz32() </strong></code>函数返回一个数字在转换成 32 无符号整形数字的二进制形式后, 开头的 0 的个数, 比如 <code>1000000</code> 转换成 32 位无符号整形数字的二进制形式后是 <code>00000000000011110100001001000000</code>, 开头的 0 的个数是 12 个, 则 <code>Math.clz32(1000000)</code> 返回 <code>12</code>.</p>
|
||||
<h2 id="Syntax" name="Syntax">语法</h2>
|
||||
<pre class="syntaxbox"><code>Math.clz32 (x)
|
||||
</code></pre>
|
||||
<pre><code class="language-javascript"><code>Math.clz32 (x)
|
||||
</code></code></pre>
|
||||
<h3 id="Parameters" name="Parameters">参数</h3>
|
||||
<dl>
|
||||
<dt>x</dt>
|
||||
@@ -17,7 +17,7 @@
|
||||
<p><code>NaN</code>, <code>Infinity</code>,<code> -Infinity</code> 这三个数字转成 32 位无符号整形数字后都是 <code>0</code>.</p>
|
||||
<p><span>这个函数主要用于那些编译目标为 JS 语言的系统中, 比如 Emscripten.</span></p>
|
||||
<h2 id="示例">示例</h2>
|
||||
<pre class="brush: js">Math.clz32(1) // 31
|
||||
<pre><code class="language-javascript">Math.clz32(1) // 31
|
||||
Math.clz32(1000) // 22
|
||||
Math.clz32() // 32
|
||||
[NaN, Infinity, -Infinity, 0, -0, null, undefined, "foo", {}, []].filter(function (n) {
|
||||
@@ -25,13 +25,13 @@ Math.clz32() // 32
|
||||
}) // []
|
||||
Math.clz32(true) // 31
|
||||
Math.clz32(3.5) // 30
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="Compatibility" name="Compatibility">Polyfill</h2>
|
||||
<pre class="brush: js">Math.clz32 = Math.clz32 || function(value) {
|
||||
<pre><code class="language-javascript">Math.clz32 = Math.clz32 || function(value) {
|
||||
var value = Number(value) >>> 0;
|
||||
return value ? 32 - value.toString(2).length : 32;
|
||||
}
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<table class="standard-table">
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user