Skip to content

Commit

Permalink
Fuck meeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee…
Browse files Browse the repository at this point in the history
…eeeeeeeeeee
  • Loading branch information
shilangyu committed Dec 3, 2023
1 parent f74e79e commit cd96e08
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/include/perfect_link.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ inline auto PerfectLink::_prepare_message(

const auto message_size = 1 + sizeof(MessageIdType) + sizeof(ProcessIdType) +
std::get<1>(metadata_value) +
sizeof(MessageSizeType) +
(std::get<1>(datas) + ... + 0) +
(sizeof...(Data) * sizeof(MessageSizeType));
if (message_size > MAX_MESSAGE_SIZE) {
Expand Down
11 changes: 6 additions & 5 deletions src/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,13 @@ int main(int argc, char** argv) {
// pack 8 datas in one message
constexpr auto pack = 8;
std::array<uint8_t, pack * sizeof(SendType)> msg;
for (SendType n = pack; n <= m; n += 8) {
for (SendType n = pack; n <= m; n += pack) {
logger.set_sent_amount(n);
for (size_t j = 1; j <= pack; j++) {
for (size_t i = 0; i < sizeof(SendType); i++) {
msg[(j - 1) * sizeof(SendType) + i] =
((n - pack + j) >> (i * 8)) & 0xff;
for (SendType j = 1; j <= pack; j++) {
const SendType num = (n - pack + j);
for (SendType i = 0; i < sizeof(SendType); i++) {
std::size_t index = (j - 1) * sizeof(SendType) + i;
msg[index] = (num >> (i * 8)) & 0xff;
}
}

Expand Down

0 comments on commit cd96e08

Please sign in to comment.