mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 23:14:13 +01:00
ircd:Ⓜ️:event: Fix integer value recast (assertion from 8ab735d002
).
This commit is contained in:
parent
60382c2371
commit
bb386c5ab4
1 changed files with 15 additions and 9 deletions
|
@ -53,21 +53,27 @@ ircd::m::event::idx
|
|||
ircd::m::index(std::nothrow_t,
|
||||
const event::id &event_id)
|
||||
{
|
||||
auto &column
|
||||
static auto &column
|
||||
{
|
||||
dbs::event_idx
|
||||
};
|
||||
|
||||
bool found;
|
||||
alignas(8) char buf[8] {0};
|
||||
bool found {false};
|
||||
event::idx ret {0};
|
||||
if(likely(event_id))
|
||||
read(column, event_id, found, buf);
|
||||
|
||||
constexpr bool safety(false); // we know buf is the right size
|
||||
return byte_view<event::idx, safety>
|
||||
{
|
||||
buf
|
||||
};
|
||||
const mutable_buffer buf
|
||||
{
|
||||
reinterpret_cast<char *>(&ret), sizeof(ret)
|
||||
};
|
||||
|
||||
const string_view val
|
||||
{
|
||||
read(column, event_id, found, buf)
|
||||
};
|
||||
}
|
||||
|
||||
return ret & boolmask<event::idx>(found);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
Loading…
Reference in a new issue