DDA ring buffer code made simpler and more efficient.