MacArthur, Ian (SELEX) (UK) wrote:
>       awake_ring_head_ = (awake_ring_head_ + 1) & (AWAKE_RING_SIZE - 1);

        Maybe I'm missing something, but surely a mod (%) would be better:

awake_ring_head_ = (++awake_ring_head_) % AWAKE_RING_SIZE;

        No power of 2 restriction (which is a bomb just waiting to go off).

        Integer divides are low overhead, and gets rid of the -1.
        The only restriction is that AWAKE_RING_SIZE never be zero ;)
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to