It is a shame you can not divide by 256 (if this creates an error in computation that is withstandable then you can save a lot of time and space) as all you would need to do is look at the high byte of the answer and no division would be necessary, to multiply, you could shift algorithms with early out checks, but this would lead to larger program space with lower process times, speed and size are unfortunately inversely proportional. to multiply x by 36 you could copy x and shift the bits left by 5 = multiply by 32 then shift the original x left by 2 = multiply by 4 then add the two numbers giving x*32 + x*4 this could be done in only a few clock cycles. ----- Original Message ----- From: Edson Brusque To: Sent: Friday, February 01, 2002 10:50 PM Subject: [PIC]: Multiplies and divides > Hello, > > I need to multiply a byte by another byte and then divide this result by > 255, like x = y * z / 255. > > At this moment, I'm using CCS-PICC built-in maths, but it's very > inneficient. The execution time for this calculation is about 1200 > instructions(!). > > Someone have an idea of a very fast math function in assembly to make > this? > > Best regards, > > Brusque > > ----------------------------------- > Edson Brusque > Research and Development > C.I.Tronics Lighting Designers Ltda > Blumenau - SC - Brazil > www.citronics.com.br > Say NO to HTML mail > ----------------------------------- > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads