1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE book PUBLIC
"-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3 "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
4 <refentry id=
"bitfieldInsert">
9 <holder>Khronos Group
</holder>
12 <refentrytitle>bitfieldInsert
</refentrytitle>
13 <manvolnum>3G
</manvolnum>
16 <refname>bitfieldInsert
</refname>
17 <refpurpose>insert a range of bits into an integer
</refpurpose>
19 <refsynopsisdiv><title>Declaration
</title>
22 <funcdef>genIType
<function>bitfieldInsert
</function></funcdef>
23 <paramdef>genIType
<parameter>base
</parameter></paramdef>
24 <paramdef>genIType
<parameter>insert
</parameter></paramdef>
25 <paramdef>int
<parameter>offset
</parameter></paramdef>
26 <paramdef>int
<parameter>bits
</parameter></paramdef>
27 </funcprototype> <funcprototype>
28 <funcdef>genUType
<function>bitfieldInsert
</function></funcdef>
29 <paramdef>genUType
<parameter>base
</parameter></paramdef>
30 <paramdef>genUType
<parameter>insert
</parameter></paramdef>
31 <paramdef>int
<parameter>offset
</parameter></paramdef>
32 <paramdef>int
<parameter>bits
</parameter></paramdef>
36 <refsect1 id=
"parameters"><title>Parameters
</title>
39 <term><parameter>base
</parameter></term>
42 Specifies the integer into which to insert
<parameter>insert
</parameter>.
47 <term><parameter>insert
</parameter></term>
50 Specifies the the value of the bits to insert.
55 <term><parameter>offset
</parameter></term>
58 Specifies the index of the first bit to insert.
63 <term><parameter>bits
</parameter></term>
66 Specifies the number of bits to insert.
72 <refsect1 id=
"description"><title>Description
</title>
74 <function>bitfieldInsert
</function> inserts the
<parameter>bits
</parameter> least significant bits of
<parameter>insert
</parameter>
75 into
<parameter>base
</parameter> at offset
<parameter>offset
</parameter>. The returned value will have bits
76 [
<parameter>offset
</parameter>,
<parameter>offset
</parameter> +
<parameter>bits
</parameter> +
1] taken from [
0,
<parameter>bits
</parameter> -
1]
77 of
<parameter>insert
</parameter> and all other bits taken directly from the corresponding bits of
<parameter>base
</parameter>. If
78 <parameter>bits
</parameter> is zero, the result will simply be the original value of
<parameter>base
</parameter>. The result will
79 be undefined if
<parameter>offset
</parameter> or
<parameter>bits
</parameter> is negative, or if the sum of
<parameter>offset
</parameter>
80 and
<parameter>bits
</parameter> is greater than the number of bits used to store the operand.
83 <refsect1 id=
"versions"><title>Version Support
</title>
84 <informaltable frame=
"topbot">
89 <entry>bitfieldInsert
</entry>#newin40#
95 <refsect1 id=
"seealso"><title>See Also
</title>
97 <citerefentry><refentrytitle>bitfieldExtract
</refentrytitle></citerefentry>
100 <refsect1 id=
"Copyright"><title>Copyright
</title>
102 Copyright
<trademark class=
"copyright"></trademark> 2011 Khronos Group.
103 This material may be distributed subject to the terms and conditions set forth in
104 the Open Publication License, v
1.0,
8 June
1999.
105 <ulink url=
"http://opencontent.org/openpub/">http://opencontent.org/openpub/
</ulink>.