commit 4db64967c9593ce4f70f62af81bf4ecf2858c16f
Author: Oswald Buddenhagen <[email protected]>
Date: Sun Dec 18 21:52:06 2016 +0100
make more use of shifted_bit()
technically, this introduces a redundant AND, but the compiler is smart
enough to prove that (((A & M) ^ B) & M) == ((A ^ B) & M).
src/common.h | 3 +++
src/sync.c | 4 +---
src/util.c | 5 -----
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/common.h b/src/common.h
index b3d36ad..7138a6e 100644
--- a/src/common.h
+++ b/src/common.h
@@ -39,6 +39,9 @@ typedef unsigned int uint;
#define __stringify(x) #x
#define stringify(x) __stringify(x)
+#define shifted_bit(in, from, to) \
+ (((uint)(in) / (from > to ? from / to : 1) * (to > from ? to / from :
1)) & to)
+
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
# define ATTR_UNUSED __attribute__((unused))
# define ATTR_NORETURN __attribute__((noreturn))
diff --git a/src/sync.c b/src/sync.c
index 06b6b85..851d61b 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -125,8 +125,6 @@ make_flags( int flags, char *buf )
#define S_NEXPIRE (1<<6) /* temporary: new expiration state */
#define S_DELETE (1<<7) /* ephemeral: flags propagation is a deletion */
-#define mvBit(in,ib,ob) ((uchar)(((uint)in) * (ob) / (ib)))
-
typedef struct sync_rec {
struct sync_rec *next;
/* string_list_t *keywords; */
@@ -1675,7 +1673,7 @@ box_loaded( int sts, void *aux )
}
} else {
/* The trigger is an expiration transaction
being ongoing ... */
- if ((t == S) && ((mvBit(srec->status, S_EXPIRE,
S_EXPIRED) ^ srec->status) & S_EXPIRED)) {
+ if ((t == S) && ((shifted_bit(srec->status,
S_EXPIRE, S_EXPIRED) ^ srec->status) & S_EXPIRED)) {
/* ... but the actual action derives
from the wanted state. */
if (srec->status & S_NEXPIRE)
aflags |= F_DELETED;
diff --git a/src/util.c b/src/util.c
index 8ac1b1a..ca4e415 100644
--- a/src/util.c
+++ b/src/util.c
@@ -784,11 +784,6 @@ conf_wakeup( wakeup_t *tmr, int to )
}
}
-#define shifted_bit(in, from, to) \
- (((uint)(in) & from) \
- / (from > to ? from / to : 1) \
- * (to > from ? to / from : 1))
-
static void
event_wait( void )
{
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel