summaryrefslogtreecommitdiff
path: root/src/dict.h
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-06-06 15:32:21 +0200
committerantirez <antirez@gmail.com>2014-07-22 17:38:22 +0200
commitd1cb6a0fc40a63238e3090c5ac5c6334a4a1af1f (patch)
tree8a4089d14f7da22508517b7871c4a0a22f7bea96 /src/dict.h
parent89af463124f303b1d681aa4b29623385a1442f94 (diff)
downloadredis-d1cb6a0fc40a63238e3090c5ac5c6334a4a1af1f.tar.gz
Add double field in dict.c entry value union.
Diffstat (limited to 'src/dict.h')
-rw-r--r--src/dict.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/dict.h b/src/dict.h
index 13f70b679..905330f5d 100644
--- a/src/dict.h
+++ b/src/dict.h
@@ -50,6 +50,7 @@ typedef struct dictEntry {
void *val;
uint64_t u64;
int64_t s64;
+ double d;
} v;
struct dictEntry *next;
} dictEntry;
@@ -114,6 +115,9 @@ typedef void (dictScanFunction)(void *privdata, const dictEntry *de);
#define dictSetUnsignedIntegerVal(entry, _val_) \
do { entry->v.u64 = _val_; } while(0)
+#define dictSetDoubleVal(entry, _val_) \
+ do { entry->v.d = _val_; } while(0)
+
#define dictFreeKey(d, entry) \
if ((d)->type->keyDestructor) \
(d)->type->keyDestructor((d)->privdata, (entry)->key)
@@ -135,6 +139,7 @@ typedef void (dictScanFunction)(void *privdata, const dictEntry *de);
#define dictGetVal(he) ((he)->v.val)
#define dictGetSignedIntegerVal(he) ((he)->v.s64)
#define dictGetUnsignedIntegerVal(he) ((he)->v.u64)
+#define dictGetDoubleVal(he) ((he)->v.d)
#define dictSlots(d) ((d)->ht[0].size+(d)->ht[1].size)
#define dictSize(d) ((d)->ht[0].used+(d)->ht[1].used)
#define dictIsRehashing(ht) ((ht)->rehashidx != -1)