I'm working on some 32-bit math routines, and here's what I've come up with so far.
High bytes: A,C,E
Low bytes: B,D,F
.E is 1 if B is a signed 16-bit integer being converted into 32-bit
If E and (B<<0
-1->A
Else
0->A
End
.F is to E as D is to B
If F and (D<<0
-1->C
Else
0->C
End
B+D->F
If B>D and (F<B) or (B<=D and (F<D
A+1->A
End
A+C->E
If Signed
B+e^(15)->E
If E<B
A+1->A
End
E->B
D+e^(15)->E
If E<D
C+1->C
End
E->D
0->E->F
.comp is the comparison being performed
If A comp C and (B comp D)
1->F
End
If Signed
B+e^(15)->E
If E<B
A-1->A
End
E->B
D+e^15->E
If E<D
C-1->C
End
E->D
End
0->E
End