*/
static inline int64_t FlowGetId(const Flow *f)
{
- return (int64_t)f->flow_hash << 31 |
+ int64_t id = (int64_t)f->flow_hash << 31 |
(int64_t)(f->startts.tv_sec & 0x0000FFFF) << 16 |
(int64_t)(f->startts.tv_usec & 0x0000FFFF);
+ /* reduce to 51 bits as Javascript and even JSON often seem to
+ * max out there. */
+ id &= 0x7ffffffffffffLL;
+ return id;
}
int FlowClearMemory(Flow *,uint8_t );
if (f == NULL)
return;
int64_t flow_id = FlowGetId(f);
- /* reduce to 51 bits as Javascript and even JSON often seem to
- * max out there. */
- flow_id &= 0x7ffffffffffffLL;
json_object_set_new(js, "flow_id", json_integer(flow_id));
}
*/
static int LuaCallbackPushFlowIdToStackFromFlow(lua_State *luastate, const Flow *f)
{
- uint64_t id = FlowGetId(f);
- /* reduce to 51 bits as Javascript and even JSON often seem to
- * max out there. */
- id &= 0x7ffffffffffffLL;
+ int64_t id = FlowGetId(f);
lua_pushinteger(luastate, id);
return 1;
}