summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2009-08-26 17:30:32 +0930
committerAndrew Tridgell <tridge@samba.org>2009-08-28 13:08:01 +1000
commit4279879c9847ca069527e11ca934b8906009cad8 (patch)
tree067e7c95487d27001ee554b4adcb2072bcc26956
parentcc248f7dfccf015586627ecef5fc5a475cc7f842 (diff)
downloadsamba-4279879c9847ca069527e11ca934b8906009cad8.tar.gz
samba-4279879c9847ca069527e11ca934b8906009cad8.tar.xz
samba-4279879c9847ca069527e11ca934b8906009cad8.zip
lib/tevent: remove spectacularly complicated manual subtraction
To be completely honest, I don't quite know whether to laugh or cry at this one: 1 + (0xFFFFFFFF & ~(s.seen - s.count)) == 1 + (~(s.seen - s.count)) # s.seen, s.count are uint32_t == s.count - s.seen # -A == ~A + 1 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r--lib/tevent/tevent_signal.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c
index f07de83a5ec..429995318be 100644
--- a/lib/tevent/tevent_signal.c
+++ b/lib/tevent/tevent_signal.c
@@ -70,10 +70,7 @@ static struct sig_state {
*/
static uint32_t sig_count(struct sigcounter s)
{
- if (s.count >= s.seen) {
- return s.count - s.seen;
- }
- return 1 + (0xFFFFFFFF & ~(s.seen - s.count));
+ return s.count - s.seen;
}
/*