JSVAL_TO_INT

  • Revision slug: SpiderMonkey/JSAPI_Reference/JSVAL_TO_INT
  • Revision title: JSVAL_TO_INT
  • Revision id: 146477
  • Created:
  • Creator: Jorend
  • Is current revision? No
  • Comment style

Revision Content

{{template.Jsapi_ref_header("JSVAL_TO_INT")}}

Converts an integer jsval to a C integer.

Syntax

JSVAL_TO_INT(v)

Description

JSVAL_TO_INT converts a specified integer jsval, v, to the corresponding C integer value. If v is any other type of value, the result is undefined.

Note that although jsval is an integer type, it must be treated as opaque. The jsval encoding of the integer 4, for instance, is not ((jsval) 4) but some other pattern of bits.

To convert an integer to jsval, use INT_FITS_IN_JSVAL and INT_TO_JSVAL.

{{template.LXRSearch("ident", "i", "JSVAL_TO_INT")}}

Revision Source

<p>{{template.Jsapi_ref_header("JSVAL_TO_INT")}}
</p><p>Converts an integer <code><a href="en/Jsval">jsval</a></code> to a C integer.
</p>
<h3 name="Syntax"> Syntax </h3>
<pre class="eval">JSVAL_TO_INT(v)
</pre>
<h3 name="Description"> Description </h3>
<p><code>JSVAL_TO_INT</code> converts a specified integer <code><a href="en/Jsval">jsval</a></code>, <code>v</code>, to the corresponding C integer value. If <code>v</code> is any other type of value, the result is undefined.
</p><p>Note that although <code>jsval</code> is an integer type, it must be treated as opaque.  The <code>jsval</code> encoding of the integer <code>4</code>, for instance, is not <code>((jsval) 4)</code> but some other pattern of bits.
</p><p>To convert an integer to <code>jsval</code>, use <code><a href="en/INT_FITS_IN_JSVAL">INT_FITS_IN_JSVAL</a></code> and <code><a href="en/INT_TO_JSVAL">INT_TO_JSVAL</a></code>.
</p><p>{{template.LXRSearch("ident", "i", "JSVAL_TO_INT")}}
</p>
Revert to this revision