-/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2010-2018. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
// initialize my node
id_ = std::stoi(args[1]);
- stream = simgrid::s4u::this_actor::getHost()->extension<HostChord>()->getStream();
+ stream = simgrid::s4u::this_actor::get_host()->extension<HostChord>()->getStream();
mailbox_ = simgrid::s4u::Mailbox::byName(std::to_string(id_));
next_finger_to_fix = 0;
fingers_ = new int[nb_bits];
if (args.size() == 3) { // first ring
deadline_ = std::stod(args[2]);
- start_time_ = simgrid::s4u::Engine::getClock();
+ start_time_ = simgrid::s4u::Engine::get_clock();
XBT_DEBUG("Create a new Chord ring...");
} else {
known_id_ = std::stoi(args[2]);
void Node::fixFingers()
{
XBT_DEBUG("Fixing fingers");
- int id = findSuccessor(id_ + powers2[next_finger_to_fix]);
+ int id = findSuccessor(id_ + (1U << next_finger_to_fix));
if (id != -1) {
if (id != fingers_[next_finger_to_fix]) {
setFinger(next_finger_to_fix, id);
XBT_VERB("My finger table:");
XBT_VERB("Start | Succ");
for (int i = 0; i < nb_bits; i++) {
- XBT_VERB(" %3d | %3d", (id_ + powers2[i]) % nb_keys, fingers_[i]);
+ XBT_VERB(" %3u | %3d", (id_ + (1U << i)) % nb_keys, fingers_[i]);
}
XBT_VERB("Predecessor: %d", pred_id_);