--- a/src/main.c Sat Aug 22 16:22:05 2026 +0200 +++ b/src/main.c Sun Aug 23 11:38:27 2026 +0200 @@ -498,8 +498,8 @@ static NetMove hton_move(const Move *move) { return (NetMove) { - .mtime_sec = htonl(move->movetime / 1000000ull), - .mtime_usec = htonl(move->movetime % 1000000ull), + .mtime_sec = net_htonl(move->movetime / 1000000ull), + .mtime_usec = net_htonl(move->movetime % 1000000ull), .piece = move->piece, .fromfile = move->fromfile, .fromrow = move->fromrow, .tofile = move->tofile, .torow = move->torow, @@ -511,7 +511,8 @@ return (Move) { .string = {0}, /* calculated before applying the move */ .timestamp = {0}, /* planned to be removed */ - .movetime = (uint64_t)move->mtime_sec * 1000000ull + move->mtime_usec, + .movetime = (uint64_t)net_ntohl(move->mtime_sec) + * 1000000ull + net_ntohl(move->mtime_usec), .piece = move->piece, .fromfile = move->fromfile, .fromrow = move->fromrow, .tofile = move->tofile, .torow = move->torow, @@ -646,7 +647,7 @@ if (code == NETCODE_DECLINE_MOVE) { uint32_t reason; net_recieve_data(opponent, &reason, sizeof(uint32_t)); - reason = ntohl(reason); + reason = net_ntohl(reason); eval_move_failed_msg(reason); } else if (code == NETCODE_ACCEPT || code == NETCODE_CHECK @@ -831,7 +832,7 @@ return 0; } } else { - uint32_t reason = htonl(code); + uint32_t reason = net_htonl(code); net_send_data(opponent, NETCODE_DECLINE_MOVE, &reason, sizeof(uint32_t)); } @@ -1081,7 +1082,7 @@ char *pgndata = malloc(pgndata_size); memcpy(pgndata, &(gamestate->info), sizeof(GameInfo)); unsigned offset = sizeof(GameInfo); - uint16_t mcn = htons(mc); + uint16_t mcn = net_htons(mc); memcpy(pgndata+offset, &mcn, 2); offset += 2; for (unsigned i = 0 ; i < mc ; i++) { @@ -1183,7 +1184,7 @@ net_recieve_data(server.fd, &(gamestate->info), sizeof(GameInfo)); uint16_t mc; net_recieve_data(server.fd, &mc, sizeof(mc)); - mc = ntohs(mc); + mc = net_ntohs(mc); char *movedata = malloc(mc * NETMOVE_LEN); net_recieve_data(server.fd, movedata, mc*NETMOVE_LEN); unsigned offset = 0;