<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Dear Matt,<br><br>I really liked your project! Great job. I also saw you where using the pow function in the sample code and i throught i could make it faster.<br>I made the pow function in BigIntegerAlgorithms.cc and it speeds up a lot! Hopefully you will also add it in your project.<br><br>Vriendelijke Groet,<br><br>Ludo Ruisch from the Netherlands ^_^<br><br>BigUnsigned pow(const BigUnsigned &a, const BigUnsigned &b)<br>{<br> BigUnsigned result = 1;<br> BigUnsigned loop_count = 0;<br> BigUnsigned multiply_result = a;<br> BigUnsigned multiply_count = 1;<br> <br> step_1:<br> multiply_result *= multiply_result;<br> multiply_count *= 2;<br> <br> if(loop_count + (multiply_count * 2) <= b)<br> {<br> goto step_1;<br> }<br> else if(loop_count + (multiply_count) <= b)<br> {<br> result *= multiply_result;<br> loop_count += multiply_count;<br> multiply_result = a;<br> multiply_count = 1;<br> <br> if(loop_count + (multiply_count * 2) <= b)<br> goto step_1;<br> }<br> result *= multiply_result;<br> <br> return result;<br>}<br> </div></body>
</html>