diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2009-08-26 17:30:32 +0930 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-08-28 13:08:01 +1000 |
commit | 4279879c9847ca069527e11ca934b8906009cad8 (patch) | |
tree | 067e7c95487d27001ee554b4adcb2072bcc26956 /lib/tevent | |
parent | cc248f7dfccf015586627ecef5fc5a475cc7f842 (diff) | |
download | samba-4279879c9847ca069527e11ca934b8906009cad8.tar.gz samba-4279879c9847ca069527e11ca934b8906009cad8.tar.bz2 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>
Diffstat (limited to 'lib/tevent')
-rw-r--r-- | lib/tevent/tevent_signal.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c index f07de83a5e..429995318b 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; } /* |