mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-12-16 07:51:52 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<h2 id="Summary" name="Summary">概述</h2>
|
||||
<p>该函数返回两个参数的类C的32位整数乘法运算的运算结果.</p>
|
||||
<h2 id="语法">语法</h2>
|
||||
<pre class="syntaxbox"><code>Math.imul(a, b)</code></pre>
|
||||
<pre><code class="language-javascript"><code>Math.imul(a, b)</code></code></pre>
|
||||
<h3 id="Parameters" name="Parameters">参数</h3>
|
||||
<dl>
|
||||
<dt><code>a</code></dt>
|
||||
@@ -14,15 +14,15 @@
|
||||
<h2 id="描述">描述</h2>
|
||||
<p><code>Math.imul</code>可以进行快速的,类C语义的32位整数乘法.该特性对于一些项目比如<a class="external" href="http://en.wikipedia.org/wiki/Emscripten" rel="noopener" title="http://en.wikipedia.org/wiki/Emscripten">Emscripten</a>很有用.</p>
|
||||
<h2 id="例子">例子</h2>
|
||||
<pre class="brush: js">Math.imul(2, 4) // 8
|
||||
<pre><code class="language-javascript">Math.imul(2, 4) // 8
|
||||
Math.imul(-1, 8) // -8
|
||||
Math.imul(-2, -2) // 4
|
||||
Math.imul(0xffffffff, 5) //-5
|
||||
Math.imul(0xfffffffe, 5) //-10
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="Polyfill">Polyfill</h2>
|
||||
<p>下面的JavaScript代码可以实现该函数:</p>
|
||||
<pre class="brush: js">function imul(a, b)
|
||||
<pre><code class="language-javascript">function imul(a, b)
|
||||
{
|
||||
var ah = (a >>> 16) & 0xffff;
|
||||
var al = a & 0xffff;
|
||||
@@ -31,7 +31,7 @@ Math.imul(0xfffffffe, 5) //-10
|
||||
// 右移0位可以修复高位的符号位
|
||||
return (al * bl) + (((ah*bl+al*bh)<<16)>>>0);
|
||||
}
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="浏览器兼容性">浏览器兼容性</h2>
|
||||
<p></p><div class="blockIndicator warning"><strong><a class="external" href="https://github.com/mdn/browser-compat-data" rel="noopener">We're converting our compatibility data into a machine-readable JSON format</a></strong>.
|
||||
This compatibility table still uses the old format,
|
||||
|
||||
Reference in New Issue
Block a user