summaryrefslogtreecommitdiff
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:35:13 +0100
commit4869633dc87dadb2b9a114444d375c39703ac863 (patch)
tree3f7e01b5b248eb45737f066c239bfafe4be09b81
parent5fbd461972cb4da117cc6b3d70a932ae4de6becf (diff)
downloadsssd-4869633dc87dadb2b9a114444d375c39703ac863.tar.gz
sssd-4869633dc87dadb2b9a114444d375c39703ac863.tar.bz2
sssd-4869633dc87dadb2b9a114444d375c39703ac863.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 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))