summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2013-01-07 15:31:44 +0100
committerJakub Hrozek <jhrozek@redhat.com>2013-01-07 17:29:46 +0100
commit7e3b02daa3e7b44f2a71152edcdfdcc63498f780 (patch)
tree09a667e22d0f83176362624df1a5180cb9cf4aa1
parentf73e8aa4b34d5be577ca7481e43b6fa87d6ed986 (diff)
downloadsssd-7e3b02daa3e7b44f2a71152edcdfdcc63498f780.tar.gz
sssd-7e3b02daa3e7b44f2a71152edcdfdcc63498f780.tar.xz
sssd-7e3b02daa3e7b44f2a71152edcdfdcc63498f780.zip
memcache: make MC_PTR_TO_SLOT() more readable
-rw-r--r--src/util/mmap_cache.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/util/mmap_cache.h b/src/util/mmap_cache.h
index 1f99c758d..55383c056 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))