php-doc-en/reference/gmp/functions/gmp-setbit.xml
2004-11-10 08:30:50 +00:00

76 lines
2.1 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
<refentry id="function.gmp-setbit">
<refnamediv>
<refname>gmp_setbit</refname>
<refpurpose>Set bit</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>gmp_setbit</methodname>
<methodparam><type>resource</type><parameter role="reference">a</parameter></methodparam>
<methodparam><type>int</type><parameter>index</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>set_clear</parameter></methodparam>
</methodsynopsis>
<para>
Sets bit <parameter>index</parameter> in
<parameter>a</parameter>. <parameter>set_clear</parameter>
defines if the bit is set to 0 or 1. By default the bit is set to
1. Index starts at 0.
</para>
<note>
<para>
Unlike most of the other GMP functions, <function>gmp_setbit</function>
must be called with a GMP resource that already exists (using
<function>gmp_init</function> for example). One will not be
automatically created.
</para>
</note>
<example>
<title><function>gmp_setbit</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$a = gmp_init("0xfd");
gmp_setbit($a, 1); // index starts at 0
echo gmp_strval($a) . "\n";
?>
]]>
</programlisting>
<para>
The printout of the above program will be:
</para>
<screen>
<![CDATA[
255
]]>
</screen>
</example>
<para>
See also <function>gmp_clrbit</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->