summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2015-01-08 00:35:16 -0800
committerdormando <dormando@rydia.net>2015-01-08 00:35:16 -0800
commite334a32df6220a2fbb5598a27b03d1e2cfd9c357 (patch)
treebf08f6404e6007db34c830dbbd1de14a21965b86
parentb689a627ea7ae45815e070f930b9b0737bee1cbc (diff)
downloadmemcached-e334a32df6220a2fbb5598a27b03d1e2cfd9c357.tar.gz
fix bitshifting transposition
Fuck me this is embarrassing. I got it right once, then flipped them everywhere else. This is why you use defines for everything. :(
-rw-r--r--items.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/items.c b/items.c
index fff5222..952b12d 100644
--- a/items.c
+++ b/items.c
@@ -859,7 +859,7 @@ static int lru_pull_tail(const int orig_id, const int cur_lru,
if (it != NULL) {
if (move_to_lru) {
- it->slabs_clsid &= ~(3>>6);
+ it->slabs_clsid &= ~(3<<6);
it->slabs_clsid |= move_to_lru;
item_link_q(it);
}
@@ -1180,7 +1180,7 @@ static item *crawler_crawl_q(item *it) {
* main thread's values too much. Should rethink again.
*/
static void item_crawler_evaluate(item *search, uint32_t hv, int i) {
- int slab_id = i & ~(3>>6);
+ int slab_id = i & ~(3<<6);
crawlerstats_t *s = &crawlerstats[slab_id];
if ((search->exptime != 0 && search->exptime < current_time)
|| is_flushed(search)) {
@@ -1246,8 +1246,8 @@ static void *item_crawler_thread(void *arg) {
crawler_unlink_q((item *)&crawlers[i]);
pthread_mutex_unlock(&lru_locks[i]);
pthread_mutex_lock(&lru_crawler_stats_lock);
- crawlerstats[i & ~(3>>6)].end_time = current_time;
- crawlerstats[i & ~(3>>6)].run_complete = true;
+ crawlerstats[i & ~(3<<6)].end_time = current_time;
+ crawlerstats[i & ~(3<<6)].run_complete = true;
pthread_mutex_unlock(&lru_crawler_stats_lock);
continue;
}
@@ -1384,8 +1384,8 @@ enum crawler_result_type lru_crawler_crawl(char *slabs) {
crawler_count++;
starts++;
pthread_mutex_lock(&lru_crawler_stats_lock);
- memset(&crawlerstats[sid & ~(3>>6)], 0, sizeof(crawlerstats_t));
- crawlerstats[sid & ~(3>>6)].start_time = current_time;
+ memset(&crawlerstats[sid & ~(3<<6)], 0, sizeof(crawlerstats_t));
+ crawlerstats[sid & ~(3<<6)].start_time = current_time;
pthread_mutex_unlock(&lru_crawler_stats_lock);
}
pthread_mutex_unlock(&lru_locks[sid]);