Derecho  0.9
Distributed systems toolkit for RDMA
message.hpp
Go to the documentation of this file.
1 #ifndef MESSAGE_HPP
2 #define MESSAGE_HPP
3 
4 #include <cstdint>
5 #include <utility>
6 
7 struct ParsedTag {
8  uint8_t reserved;
9  uint8_t padding; // now used for libfabric opcode.
10  uint16_t group_number;
11  uint32_t target;
12 };
13 
14 inline ParsedTag parse_tag(uint64_t t) {
15  return ParsedTag{0, 0, (uint16_t)((t & 0x0000ffff00000000ull) >> 32),
16  (uint32_t)(t & 0x00000000ffffffffull)};
17 }
18 inline uint64_t form_tag(uint16_t group_number, uint32_t target) {
19  return (((uint64_t)group_number) << 32) | (uint64_t)target;
20 }
21 
23  uint16_t total_blocks;
24  uint16_t block_number;
25 };
26 
27 inline ParsedImmediate parse_immediate(uint32_t imm) {
28  return ParsedImmediate{(uint16_t)((imm & 0xffff0000) >> 16),
29  (uint16_t)(imm & 0x0000ffff)};
30 }
31 inline uint32_t form_immediate(uint16_t total_blocks, uint16_t block_number) {
32  return ((uint32_t)total_blocks) << 16 | ((uint32_t)block_number);
33 }
34 
35 #endif
uint8_t padding
Definition: message.hpp:9
uint32_t form_immediate(uint16_t total_blocks, uint16_t block_number)
Definition: message.hpp:31
uint16_t group_number
Definition: message.hpp:10
ParsedImmediate parse_immediate(uint32_t imm)
Definition: message.hpp:27
uint64_t form_tag(uint16_t group_number, uint32_t target)
Definition: message.hpp:18
ParsedTag parse_tag(uint64_t t)
Definition: message.hpp:14
uint8_t reserved
Definition: message.hpp:8
uint32_t target
Definition: message.hpp:11
uint16_t block_number
Definition: message.hpp:24
uint16_t total_blocks
Definition: message.hpp:23