o [email protected] on 05/23/2011 04:56 PM:
Why is ts_less written this way?inline bool ts_less::operator()(const unsigned int& l, const unsigned int& r) const { return (l - r> (unsigned int)(1<<31)); } A naive programmer would think that (l< r) would work just as well. Also, it seems like there are cases where the function would return the incorrect value, as when l==0x80000002 and r==0x00000001.
the timestamps are 32 bit values wrapping around at 0xffffffff (e.g. 0xffffffff < 0x00 is true). if you think of the numbers as circle instead of a line, then the comparision always works on the same half of the circle - if the difference is more than half of a circle, then it's wrapped around one time.
Stefan _______________________________________________ Sems mailing list [email protected] http://lists.iptel.org/mailman/listinfo/sems
