| 50 | } // namespace |
| 51 | |
| 52 | int64_t EncodeTaskIdToInt64(const TaskId& task_id) { |
| 53 | int64_t id = static_cast<int64_t>(task_id.task_index()); |
| 54 | id |= static_cast<int64_t>(task_id.stream_id().stream_index()) << kStreamIndexShift; |
| 55 | id |= static_cast<int64_t>(task_id.stream_id().device_index()) << kDeviceIndexShift; |
| 56 | id |= static_cast<int64_t>(task_id.stream_id().device_type()) << kDeviceTypeShift; |
| 57 | id |= static_cast<int64_t>(task_id.stream_id().rank()) << kRankShift; |
| 58 | return id; |
| 59 | } |
| 60 | |
| 61 | TaskId DecodeTaskIdFromInt64(int64_t task_id_val) { |
| 62 | int64_t rank = (task_id_val & kRankInt64Mask) >> kRankShift; |
no test coverage detected