Fix issue with INVALID_EXPIRE overlapping with mask
Former-commit-id: a6bbbeffcf7b5af5e67517aed01cabae51169c0a
This commit is contained in:
parent
7a799faa04
commit
9b201b31c3
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define INVALID_EXPIRE LLONG_MIN
|
// eventually this number might actually end up being a valid expire time, this could cause bugs so at that time it might be a good idea to use a larger data type.
|
||||||
|
#define INVALID_EXPIRE (LLONG_MIN & ~((1LL) << (sizeof(long long)*CHAR_BIT - 1)))
|
||||||
|
|
||||||
class expireEntryFat
|
class expireEntryFat
|
||||||
{
|
{
|
||||||
@ -60,11 +61,12 @@ class expireEntry {
|
|||||||
sds m_key;
|
sds m_key;
|
||||||
expireEntryFat *m_pfatentry;
|
expireEntryFat *m_pfatentry;
|
||||||
} u;
|
} u;
|
||||||
long long m_when; // LLONG_MIN means this is a fat entry and we should use the pointer
|
long long m_when; // bit wise and with FFatMask means this is a fat entry and we should use the pointer
|
||||||
|
|
||||||
long long FFatMask() const noexcept {
|
long long FFatMask() const noexcept {
|
||||||
return (1LL) << (sizeof(long long)*CHAR_BIT - 1);
|
return (1LL) << (sizeof(long long)*CHAR_BIT - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class iter
|
class iter
|
||||||
{
|
{
|
||||||
@ -175,7 +177,7 @@ public:
|
|||||||
}
|
}
|
||||||
long long whenFull() const noexcept
|
long long whenFull() const noexcept
|
||||||
{
|
{
|
||||||
return (m_when & (~FFatMask())) != 0;
|
return m_when & (~FFatMask());
|
||||||
}
|
}
|
||||||
|
|
||||||
void update(const char *subkey, long long when)
|
void update(const char *subkey, long long when)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user