git.samba.org
/
ira
/
wip.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cc248f7
)
lib/tevent: remove spectacularly complicated manual subtraction
author
Rusty Russell
<rusty@rustcorp.com.au>
Wed, 26 Aug 2009 08:00:32 +0000
(17:30 +0930)
committer
Andrew Tridgell
<tridge@samba.org>
Fri, 28 Aug 2009 03:08:01 +0000
(13:08 +1000)
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>
lib/tevent/tevent_signal.c
patch
|
blob
|
history
diff --git
a/lib/tevent/tevent_signal.c
b/lib/tevent/tevent_signal.c
index f07de83a5ec43aa518f2d4c9d6744dcc0d995a83..429995318be8787bcbd664b804fa76c03b69037a 100644
(file)
--- 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;
}
/*