79343399

Date: 2025-01-09 16:41:45
Score: 1.5
Natty:
Report link

You can combine message offset and message identifier into a single integer (let's call it moi - message offset and id): moi=message_offset*n+message_id, where n is a constant high limit of message identifiers.

Now, to register a new message you should atomically read moi and add new_message_length*n+1 to it. To get offset use moi/n, to get id - moi%n.

Reasons:
  • No code block (0.5):
  • Low reputation (1):
Posted by: Dmitry Zhitlukhin