From 4869633dc87dadb2b9a114444d375c39703ac863 Mon Sep 17 00:00:00 2001 From: Pavel Březina Date: Mon, 7 Jan 2013 15:31:44 +0100 Subject: memcache: make MC_PTR_TO_SLOT() more readable --- src/util/mmap_cache.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/util/mmap_cache.h') diff --git a/src/util/mmap_cache.h b/src/util/mmap_cache.h index 1f99c758..55383c05 100644 --- a/src/util/mmap_cache.h +++ b/src/util/mmap_cache.h @@ -63,8 +63,7 @@ typedef uint32_t rel_ptr_t; */ #define MC_SLOT_SIZE 32 #define MC_SIZE_TO_SLOTS(len) (((len) + (MC_SLOT_SIZE - 1)) / MC_SLOT_SIZE) -#define MC_PTR_TO_SLOT(base, ptr) \ - (((uint8_t *)(ptr) - (uint8_t *)(base)) / MC_SLOT_SIZE) +#define MC_PTR_TO_SLOT(base, ptr) (MC_PTR_DIFF(ptr, base) / MC_SLOT_SIZE) #define MC_SLOT_TO_PTR(base, slot, type) \ (type *)((base) + ((slot) * MC_SLOT_SIZE)) -- cgit