> check lowest bit of number, if '1' then add one to number *then* divide by > two You don't need to check if the low bit is 1. Simply add 1. This will generate a carry into the rest of the number if the low bit was one. Of course you now have to worry about the original number being at maximum. You either have to check this, or add one to the *shifted* number if the original low bit was 1. However, in most cases truncation is either fine or is actually what you want. ******************************************************************** Olin Lathrop, embedded systems consultant in Littleton Massachusetts (978) 742-9014, olin@embedinc.com, http://www.embedinc.com -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads