What is the actual values (including intermediates!) you encounter? Any chance they end up between 32768 and 65536? If so, change those ints to unsigned ints.
Any change of values going >65535? Then you'll have to start using unsigned long.
What is the actual values (including intermediates!) you encounter? Any chance they end up between 32768 and 65536? If so, change those ints to unsigned ints.
Any change of values going >65535? Then you'll have to start using unsigned long.