Divide {<spanclass="parameter">sp</span>, <spanclass="parameter">n</span>} by 3, expecting it to divide exactly, and writing the result to {<spanclass="parameter">rp</span>, <spanclass="parameter">n</span>}.
</pre></div></div></div><scripttype="text/javascript">AddLanguageTabSet("ID0EDCA");</script><h4class="subHeading">Parameters</h4><dl><dt><spanclass="parameter">rp</span></dt><dd>Type:<ahref="4609ac5e-5cf9-cd20-2fa9-8040101c165c.htm">Math.Gmp.Native<spanid="LST2706CA61_1"></span><scripttype="text/javascript">AddLanguageSpecificTextSet("LST2706CA61_1?cs=.|vb=.|cpp=::|nu=.|fs=.");</script>mp_ptr</a><br/>The result integer.</dd><dt><spanclass="parameter">sp</span></dt><dd>Type:<ahref="4609ac5e-5cf9-cd20-2fa9-8040101c165c.htm">Math.Gmp.Native<spanid="LST2706CA61_2"></span><scripttype="text/javascript">AddLanguageSpecificTextSet("LST2706CA61_2?cs=.|vb=.|cpp=::|nu=.|fs=.");</script>mp_ptr</a><br/>The operand integer.</dd><dt><spanclass="parameter">n</span></dt><dd>Type:<ahref="4b58a584-7a0e-b600-18fa-ebd493861eb3.htm">Math.Gmp.Native<spanid="LST2706CA61_3"></span><scripttype="text/javascript">AddLanguageSpecificTextSet("LST2706CA61_3?cs=.|vb=.|cpp=::|nu=.|fs=.");</script>mp_size_t</a><br/>The number of limbs in <spanclass="parameter">sp</span>.</dd></dl><h4class="subHeading">Return Value</h4>Type:<ahref="bf1f694d-f9b2-6413-12e5-ebae603d5b49.htm">mp_limb_t</a><br/>If 3 divides exactly, the return value is zero and the result is the quotient. If not, the return value is non-zero and the result won’t be anything useful.</div><divclass="collapsibleAreaRegion"><spanclass="collapsibleRegionTitle"onclick="SectionExpandCollapse('ID2RB')"onkeypress="SectionExpandCollapse_CheckKey('ID2RB', event)"tabindex="0"><imgid="ID2RBToggle"class="collapseToggle"src="../icons/SectionExpanded.png"/>Remarks</span></div><divid="ID2RBSection"class="collapsibleSection"><p><ahref="c40ea3de-d1be-146b-fe7a-deff566ca817.htm">mpn_divexact_by3c</a> takes an initial carry parameter, which can be the return value from a previous call,
<spanclass="selflink">mpn_divexact_by3</span> is simply a macro calling <ahref="c40ea3de-d1be-146b-fe7a-deff566ca817.htm">mpn_divexact_by3c</a> with a 0 carry parameter.
mp_ptr rp = <spanclass="highlight-keyword">new</span> mp_ptr(<spanclass="highlight-keyword">new</span><spanclass="highlight-keyword">uint</span>[<spanclass="highlight-number">2</span>]);
mp_ptr result = <spanclass="highlight-keyword">new</span> mp_ptr(<spanclass="highlight-keyword">new</span><spanclass="highlight-keyword">uint</span>[] { <spanclass="highlight-number">0x55555555</span>, <spanclass="highlight-number">0x00005555</span> });
<spanclass="highlight-comment">// Set rp = sp / 3.</span>
gmp_lib.free(rp, sp, result)</pre></div><divid="ID0EDAABA_code_Div3"class="codeSnippetContainerCode"style="display: none"><p>No code example is currently available or this language may not be supported.</p></div><divid="ID0EDAABA_code_Div4"class="codeSnippetContainerCode"style="display: none"><p>No code example is currently available or this language may not be supported.</p></div></div></div><scripttype="text/javascript">AddLanguageTabSet("ID0EDAABA");</script></div><divclass="collapsibleAreaRegion"id="seeAlsoSection"><spanclass="collapsibleRegionTitle"onclick="SectionExpandCollapse('ID4RB')"onkeypress="SectionExpandCollapse_CheckKey('ID4RB', event)"tabindex="0"><imgid="ID4RBToggle"class="collapseToggle"src="../icons/SectionExpanded.png"/>See Also</span></div><divid="ID4RBSection"class="collapsibleSection"><h4class="subHeading">Reference</h4><divclass="seeAlsoStyle"><ahref="3af6b34c-3242-2b75-e7c7-ab79af8a4b0f.htm">gmp_lib Class</a></div><divclass="seeAlsoStyle"><ahref="d9c51b9f-0c54-770b-28ea-6eebd8fef368.htm">Math.Gmp.Native Namespace</a></div><divclass="seeAlsoStyle"><ahref="b9df04c4-224e-f2ad-8e90-fbb3b30bd76d.htm">mpn_add</a></div><divclass="seeAlsoStyle"><ahref="5562b14f-48a4-be75-2eb0-6a129cd0d5ab.htm">mpn_add_1</a></div><divclass="seeAlsoStyle"><ahref="339edb73-5781-7d73-97b6-9b73451a698f.htm">mpn_add_n</a></div><divclass="seeAlsoStyle"><ahref="77fdf32b-986d-4df3-3c76-022e3e3fbb98.htm">mpn_addmul_1</a></div><divclass="seeAlsoStyle"><ahref="1d6343a5-d42c-c362-714e-e10730e6a6d5.htm">mpn_divexact_1</a></div><divclass="seeAlsoStyle"><ahref="c40ea3de-d1be-146b-fe7a-deff566ca817.htm">mpn_divexact_by3c</a></div><divclass="seeAlsoStyle"><ahref="9074a45b-0d68-cf18-75fe-076e720a9a61.htm">mpn_divmod_1</a></div><divclass="seeAlsoStyle"><ahref="f5c3f25d-1ad5-b3be-fc4b-280a62869912.htm">mpn_divrem_1</a></div><divclass="seeAlsoStyle"><ahref="9aa24cc8-8cf5-4b8a-cd1b-5ded400efa50.htm">mpn_mod_1</a></div><divclass="seeAlsoStyle"><ahref="68d3161d-2909-1909-cda7-e87949ee27ce.htm">mpn_mul</a></div><divclass="seeAlsoStyle"><ahref="b819fb3b-5d3e-ff23-1687-0e71af684bd7.htm">mpn_mul_1</a></div><divclass="seeAlsoStyle"><ahref="ee321a9a-852a-993e-f602-72ff2af02ff6.htm">mpn_mul_n</a></div><divclass="seeAlsoStyle"><ahref="9fb96802-e56e-8fd8-cef2-b44870d09a10.htm">mpn_neg</a></div><divclass="seeAlsoStyle"><ahref="87681f32-b766-3ce2-7c08-98b2d32cb5fa.htm">mpn_sub</a></div><divclass="seeAlsoStyle"><ahref="ae3c6cf7-08a0-54dd-951f-b2fe2112b8b0.htm">mpn_sub_1</a></div><divclass="seeAlsoStyle"><ahref="b104184e-cf49-dbdb-764a-9dee5cf7b2fd.htm">mpn_sub_n</a></div><divclass="seeAlsoStyle"><ahref="95e10fea-31c2-e900-c5b0-f48636e1d76e.htm">mpn_submul_1</a></div><divclass="seeAlsoStyle"><ahref="ff9c2930-ded2-c5b6-46dd-3ff9279cdc5e.htm">mpn_sqr</a></div><divclass="seeAlsoStyle"><ahref="ee31871c-38bd-fccc-77f5-e76909dd7a79.htm">mpn_sqrtrem</a></div><divclass="seeAlsoStyle"><ahref="9fe90631-f519-1cf3-5a20-701d2bae1d0d.htm">mpn_tdiv_qr</a></div><divclass="seeAlsoStyle"><ahref="3af6b34c-3242-2b75-e7c7-ab79af8a4b0f.htm"><ahref="/Math.Gmp.Native/html/3af6b34c-3242-2b75-e7c7-ab79af8a4b0f.htm#Low_level_Functions">Low-level Functions</a></a></div><divclass="seeAlsoStyle"><ahref="3af6b34c-3242-2b75-e7c7-ab79af8a4b0f.htm"><ahref="https://gmplib.org/manual/Low_002dlevel-Functions.html#Low_002dlevel-Functions">GNU MP - Low-level Functions</a></a></div></div></div></div><divid="pageFooter"class="pageFooter"></div></body></html>