Curtis Thompson

64-bit HC08 integer math routines here

Discussion created by Curtis Thompson on Mar 26, 2009
Latest reply on Mar 30, 2009 by Curtis Thompson

I needed to do some 64-bit integer math for a project I'm doing.  I looked around and found a paper that describes a method sort of like long division and has some source in Pascal.  The paper is "Multiple-length Division Revisited: a Tour of the Minefield" by Brinch Hansen, June 1994.  Here is a link to the paper:  The problem is, the calcs I need to make took about 500ms.


Next I took to assembly code from AN1219, "M68HC08 Integer Math Routines" (  This has a 32-bit by 16-bit divide that I ported to inline assembly.  I extrapolated that code to produce a 64-bit by 32-bit divide.  There are some multiply and right shift routines there as well.  With this version of code, I was able to do the same calcs in 16.9ms (better).


It's not the pretties code but I hope others might find the attached code useful.