Introduce two temporary variables to avoid having to repeat
expressions. This patch does not change any functionality.
Signed-off-by: Bart Van Assche <redacted>
---
drivers/md/bcache/bcache.h | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h
index 12e5197f186c..72b1ea4576d9 100644
--- a/drivers/md/bcache/bcache.h
+++ b/drivers/md/bcache/bcache.h
@@ -777,10 +777,12 @@ static inline bool ptr_available(struct cache_set *c, const struct bkey *k,
* This is used for various on disk data structures - cache_sb, prio_set, bset,
* jset: The checksum is _always_ the first 8 bytes of these structs
*/
-#define csum_set(i) \
- bch_crc64(((void *) (i)) + sizeof(uint64_t), \
- ((void *) bset_bkey_last(i)) - \
- (((void *) (i)) + sizeof(uint64_t)))
+#define csum_set(i) ({ \
+ const void *p = (void *)(i) + sizeof(uint64_t); \
+ const void *q = bset_bkey_last(i); \
+ \
+ bch_crc64(p, q - p); \
+})
/* Error handling macros */
--
2.16.2