X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fstp.c;h=3e9a5b6a800104bd1c9d203f62c06f2bccc3d7d2;hb=97d6520bea3b779d1acee7b1b2fd8ed60269078f;hp=62c2ea8acaf3c5203e8cb664ec2717459c09a1b7;hpb=80740385d2700b1a03d28a02338d02509fd0b697;p=openvswitch diff --git a/lib/stp.c b/lib/stp.c index 62c2ea8a..3e9a5b6a 100644 --- a/lib/stp.c +++ b/lib/stp.c @@ -192,7 +192,6 @@ static void stp_update_bridge_timers(struct stp *); static int clamp(int x, int min, int max); static int ms_to_timer(int ms); -static int ms_to_timer_remainder(int ms); static int timer_to_ms(int timer); static void stp_start_timer(struct stp_timer *, int value); static void stp_stop_timer(struct stp_timer *); @@ -281,7 +280,7 @@ stp_tick(struct stp *stp, int ms) * are called too frequently. */ ms = clamp(ms, 0, INT_MAX - 1000) + stp->elapsed_remainder; elapsed = ms_to_timer(ms); - stp->elapsed_remainder = ms_to_timer_remainder(ms); + stp->elapsed_remainder = ms - timer_to_ms(elapsed); if (!elapsed) { return; } @@ -1253,14 +1252,6 @@ ms_to_timer(int ms) return ms * 0x100 / 1000; } -/* Returns the number of leftover milliseconds when 'ms' is converted to STP - * timer ticks. */ -static int -ms_to_timer_remainder(int ms) -{ - return ms * 0x100 % 1000; -} - /* Returns the number of whole milliseconds in 'timer' STP timer ticks. There * are 256 STP timer ticks per second. */ static int