Re: [cc65] 16x16 multiply routine overflow detection

Date: 2010-01-20 01:08:43
Thanks Ullrich, I'll check it out.

I did come up with a sort of a solution though... I am actually doing two different muliplies, and the overflow can only happen in the second one.  I'm hanging onto the result from the first calculation and comparing that with the result from the second.  If the second result is less than the first, than there must have been an overflow.  This works for my application (I think-I haven't tested all cases), but isn't very elegant.

----- Original Message -----
From: Ullrich von Bassewitz <>
Date: Tuesday, January 19, 2010 10:35 am

> If you're using the snapshot, my suggestion would be to use the new
> cc65_umul16x16r32 routine (which is declared with some other new 
> stuff in
> cc65.h). It multiplies two 16 bit numbers and generates a 32 bit 
> result, so
> it's easy to check for an overflow.

To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Jan 20 01:08:50 2010

This archive was generated by hypermail 2.1.8 : 2010-01-20 01:08:52 CET