<div dir="ltr"><div><div><div>Or, here is an implementation of 128-bit division:<br><br>Unsigned:<cite class=""> <a href="https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/builtins/">https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/builtins/</a><b>udivmodti4</b>.c</cite><br></div>Signed: <cite class=""><a href="https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/builtins/">https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/builtins/</a><b>divti3</b>.c<br></cite></div><cite class=""><a href="https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/builtins/">https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/builtins/</a><b>modti3</b>.c<br><br></cite></div><cite class="">Leo<br></cite></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 10, 2016 at 5:22 PM, Leo Broukhis <span dir="ltr"><<a href="mailto:leob@mailcom.com" target="_blank">leob@mailcom.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>As a first step, you can try using <a href="https://gmplib.org/" target="_blank">https://gmplib.org/</a><br><br></div>Leo<br><br><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, 11 Jun 2016 00:46:02 +0100, "Dave Wade" <<a href="mailto:dave.g4ugm@gmail.com" target="_blank">dave.g4ugm@gmail.com</a>> wrote:<br><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Whilst its not a SIMH simulator, I hope you can help. I want to write an<br>
emulator for the Pegasus. The Ferranti Pegasus was (there are none operating<br>
at present) a strange beast with two 18-bit instructions per 39-bit word.<br>
Generally, it does 39-bit twos complement arithmetic. The multiply results<br>
in a 77-bit result which I have no problems implementing.<br>
<br>
Where I am struggling is with the divide. I need to be able to divide a<br>
77-bit number by a 39-bit number and get a 39 bit quotient and a 39 bit<br>
remainder. As the compiler I am using only does 64-bit numbers this is<br>
proving challenging. Any one got a good article on how to do this?<br>
<br>
Dave Wade<br>
G4UGM<br></blockquote></div></div></div></div></div>
</blockquote></div><br></div>