if (prefix == 0) {
return 0;
} else {
- return (1U << ((unsigned int)(prefix - 1))) ^ id;
+ return (1U << (prefix - 1)) ^ id;
}
}
if (prefix == 0) {
return 0;
} else {
- return (1U << ((unsigned int)(prefix - 1))) ^ id;
+ return (1U << (prefix - 1)) ^ id;
}
}
cnst.usage_ = elem.consumption_weight / elem.variable->sharing_penalty_;
elem.make_active();
- resource::Action* action = static_cast<resource::Action*>(elem.variable->id_);
+ resource::Action* action = elem.variable->id_;
if (modified_set_ && not action->is_within_modified_set())
modified_set_->push_back(*action);
}
for (auto const& link : e_route->link_list) {
route->link_list.insert(route->link_list.begin(), link);
if (lat)
- *lat += static_cast<resource::LinkImpl*>(link)->get_latency();
+ *lat += link->get_latency();
}
}
for (auto const& link : e_route->link_list) {
route->link_list.insert(route->link_list.begin(), link);
if (lat)
- *lat += static_cast<resource::LinkImpl*>(link)->get_latency();
+ *lat += link->get_latency();
}
}
NetZoneImpl* current = src->get_englobing_zone();
while (current != nullptr) {
path_src.push_back(current);
- current = static_cast<NetZoneImpl*>(current->get_father());
+ current = current->get_father();
}
std::vector<NetZoneImpl*> path_dst;
current = dst->get_englobing_zone();
while (current != nullptr) {
path_dst.push_back(current);
- current = static_cast<NetZoneImpl*>(current->get_father());
+ current = current->get_father();
}
/* (3) find the common father.
std::vector<NetZoneImpl*> path_src;
NetZoneImpl* current = src->get_englobing_zone();
while (current != nullptr) {
- path_src.push_back(static_cast<NetZoneImpl*>(current));
+ path_src.push_back(current);
current = current->father_;
}
std::vector<NetZoneImpl*> path_dst;
current = dst->get_englobing_zone();
while (current != nullptr) {
- path_dst.push_back(static_cast<NetZoneImpl*>(current));
+ path_dst.push_back(current);
current = current->father_;
}
int current_dimension = dimensions_[j]; // which dimension are we currently in?
// we need to iterate over all dimensions and create all links there
// The other node the link connects
- int neighbor_rank_id = ((static_cast<int>(rank) / dim_product) % current_dimension == current_dimension - 1)
+ int neighbor_rank_id = ((rank / dim_product) % current_dimension == current_dimension - 1)
? rank - (current_dimension - 1) * dim_product
: rank + dim_product;
// name of neighbor is not right for non contiguous cluster radicals (as id != rank in this case)
pattern->comm_addr = static_cast<kernel::activity::CommImpl*>(simcall_comm_isend__getraw__result(request));
Remote<kernel::activity::CommImpl> temp_synchro;
- mc_model_checker->get_remote_simulation().read(
- temp_synchro, remote(static_cast<kernel::activity::CommImpl*>(pattern->comm_addr)));
- const kernel::activity::CommImpl* synchro = static_cast<kernel::activity::CommImpl*>(temp_synchro.get_buffer());
+ mc_model_checker->get_remote_simulation().read(temp_synchro, remote(pattern->comm_addr));
+ const kernel::activity::CommImpl* synchro = temp_synchro.get_buffer();
char* remote_name = mc_model_checker->get_remote_simulation().read<char*>(RemotePtr<char*>(
(uint64_t)(synchro->get_mailbox() ? &synchro->get_mailbox()->name_ : &synchro->mbox_cpy->name_)));
#endif
Remote<kernel::activity::CommImpl> temp_comm;
- mc_model_checker->get_remote_simulation().read(
- temp_comm, remote(static_cast<kernel::activity::CommImpl*>(pattern->comm_addr)));
+ mc_model_checker->get_remote_simulation().read(temp_comm, remote(pattern->comm_addr));
const kernel::activity::CommImpl* comm = temp_comm.get_buffer();
char* remote_name;
// For each enabled transition in the property automaton, push a
// (application_state, automaton_state) pair to the exploration stack:
for (int i = xbt_dynar_length(current_pair->automaton_state->out) - 1; i >= 0; i--) {
- const xbt_automaton_transition* transition_succ = (xbt_automaton_transition_t)xbt_dynar_get_as(
- current_pair->automaton_state->out, i, xbt_automaton_transition_t);
+ const xbt_automaton_transition* transition_succ =
+ xbt_dynar_get_as(current_pair->automaton_state->out, i, xbt_automaton_transition_t);
if (evaluate_label(transition_succ->label, *prop_values))
exploration_stack_.push_back(this->create_pair(current_pair.get(), transition_succ->dst, prop_values));
}
} else if ((heapinfo1->type > 0) && (heapinfo2->type > 0)) { /* Fragmented block */
// Fragment number:
- ssize_t frag1 = ((uintptr_t)(ADDR2UINT(area1) % (BLOCKSIZE))) >> heapinfo1->type;
- ssize_t frag2 = ((uintptr_t)(ADDR2UINT(area2) % (BLOCKSIZE))) >> heapinfo2->type;
+ ssize_t frag1 = (ADDR2UINT(area1) % BLOCKSIZE) >> heapinfo1->type;
+ ssize_t frag2 = (ADDR2UINT(area2) % BLOCKSIZE) >> heapinfo2->type;
// Process address of the fragment_:
void* real_addr_frag1 = (void*)((char*)real_addr_block1 + (frag1 << heapinfo1->type));
// If the variable is not in this object, skip it:
// We do not expect to find a pointer to something which is not reachable
// by the global variables.
- if ((char *) current_var.address < (char *) object_info->start_rw
- || (char *) current_var.address > (char *) object_info->end_rw)
+ if ((char*)current_var.address < object_info->start_rw || (char*)current_var.address > object_info->end_rw)
continue;
const simgrid::mc::Type* bvariable_type = current_var.type;
// TODO, support DW_AT_ranges
uint64_t low_pc = MC_dwarf_attr_integrate_addr(die, DW_AT_low_pc);
- frame.range.begin() = low_pc ? (std::uint64_t)base + low_pc : 0;
+ frame.range.begin() = low_pc ? base + low_pc : 0;
if (low_pc) {
// DW_AT_high_pc:
Dwarf_Attribute attr;
memcmp((char*)data->d_buf + name_pos, "GNU", sizeof("GNU")) == 0) {
XBT_DEBUG("Found GNU/NT_GNU_BUILD_ID note");
char* start = (char*)data->d_buf + desc_pos;
- char* end = (char*)start + nhdr.n_descsz;
+ char* end = start + nhdr.n_descsz;
return std::vector<char>(start, end);
}
}
case SIMCALL_COMM_WAIT: {
/* FIXME: check also that src and dst processes are not suspended */
- const kernel::activity::CommImpl* act =
- static_cast<kernel::activity::CommImpl*>(simcall_comm_wait__getraw__comm(req));
+ const kernel::activity::CommImpl* act = simcall_comm_wait__getraw__comm(req);
if (act->src_timeout_ || act->dst_timeout_) {
/* If it has a timeout it will be always be enabled (regardless of who declared the timeout),
{
simgrid::mc::RemotePtr<simgrid::kernel::activity::CommImpl> comm_addr{nullptr};
if (call_type == MC_CALL_TYPE_WAIT)
- comm_addr = remote(static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__getraw__comm(req)));
+ comm_addr = remote(simcall_comm_wait__getraw__comm(req));
else {
simgrid::kernel::activity::ActivityImpl* addr;
{
switch (r->call_) {
case SIMCALL_COMM_WAIT:
- return static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__getraw__comm(r));
+ return simcall_comm_wait__getraw__comm(r);
case SIMCALL_COMM_TEST:
- return static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_test__getraw__comm(r));
+ return simcall_comm_test__getraw__comm(r);
default:
return nullptr;
}
}
case SIMCALL_COMM_WAIT: {
- simgrid::kernel::activity::CommImpl* remote_act =
- static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__getraw__comm(req));
+ simgrid::kernel::activity::CommImpl* remote_act = simcall_comm_wait__getraw__comm(req);
char* p;
if (value == -1) {
type = "WaitTimeout";
simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_synchro;
const simgrid::kernel::activity::CommImpl* act;
if (use_remote_comm) {
- mc_model_checker->get_remote_simulation().read(
- temp_synchro, remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
+ mc_model_checker->get_remote_simulation().read(temp_synchro, remote(remote_act));
act = temp_synchro.get_buffer();
} else
act = remote_act;
}
case SIMCALL_COMM_TEST: {
- simgrid::kernel::activity::CommImpl* remote_act =
- static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_test__getraw__comm(req));
+ simgrid::kernel::activity::CommImpl* remote_act = simcall_comm_test__getraw__comm(req);
simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_synchro;
const simgrid::kernel::activity::CommImpl* act;
if (use_remote_comm) {
- mc_model_checker->get_remote_simulation().read(
- temp_synchro, remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
+ mc_model_checker->get_remote_simulation().read(temp_synchro, remote(remote_act));
act = temp_synchro.get_buffer();
} else
act = remote_act;
case SIMCALL_COMM_WAIT: {
simgrid::mc::RemotePtr<simgrid::kernel::activity::CommImpl> remote_act =
- remote(static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__getraw__comm(&actor->simcall_)));
+ remote(simcall_comm_wait__getraw__comm(&actor->simcall_));
simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_act;
mc_model_checker->get_remote_simulation().read(temp_act, remote_act);
const simgrid::kernel::activity::CommImpl* act = temp_act.get_buffer();
message.fragment = -1;
heap->heapinfo[message.block].busy_block.ignore++;
} else {
- message.fragment = ((uintptr_t)(ADDR2UINT(address) % (BLOCKSIZE))) >> heap->heapinfo[message.block].type;
+ message.fragment = (ADDR2UINT(address) % BLOCKSIZE) >> heap->heapinfo[message.block].type;
heap->heapinfo[message.block].busy_frag.ignore[message.fragment]++;
}
/* Update vcpu's action for the new pm */
/* create a cpu action bound to the pm model at the destination. */
- kernel::resource::CpuAction* new_cpu_action =
- static_cast<kernel::resource::CpuAction*>(destination->pimpl_cpu->execution_start(0, this->core_amount_));
+ kernel::resource::CpuAction* new_cpu_action = destination->pimpl_cpu->execution_start(0, this->core_amount_);
if (action_->get_remains_no_update() > 0)
XBT_CRITICAL("FIXME: need copy the state(?), %f", action_->get_remains_no_update());
void mpi_win_allocate_(MPI_Aint* size, int* disp_unit, int* info, int* comm, void* base, int* win, int* ierr)
{
MPI_Win tmp;
- *ierr = MPI_Win_allocate( *size, *disp_unit, simgrid::smpi::Info::f2c(*info), simgrid::smpi::Comm::f2c(*comm),static_cast<void*>(base),&tmp);
+ *ierr =
+ MPI_Win_allocate(*size, *disp_unit, simgrid::smpi::Info::f2c(*info), simgrid::smpi::Comm::f2c(*comm), base, &tmp);
if(*ierr == MPI_SUCCESS) {
*win = tmp->add_f();
}
MPI_Errhandler PMPI_Errhandler_f2c(MPI_Fint errhan){
if(errhan==-1)
return MPI_ERRHANDLER_NULL;
- return static_cast<MPI_Errhandler>(simgrid::smpi::Errhandler::f2c(errhan));
+ return simgrid::smpi::Errhandler::f2c(errhan);
}
MPI_Fint PMPI_Errhandler_c2f(MPI_Errhandler errhan){
MPI_Comm PMPI_Comm_f2c(MPI_Fint comm){
if(comm==-1)
return MPI_COMM_NULL;
- return static_cast<MPI_Comm>(simgrid::smpi::Comm::f2c(comm));
+ return simgrid::smpi::Comm::f2c(comm);
}
MPI_Fint PMPI_Comm_c2f(MPI_Comm comm){
MPI_Info PMPI_Info_f2c(MPI_Fint info){
if(info==-1)
return MPI_INFO_NULL;
- return static_cast<MPI_Info>(simgrid::smpi::Info::f2c(info));
+ return simgrid::smpi::Info::f2c(info);
}
MPI_Fint PMPI_Info_c2f(MPI_Info info){
MPI_Op PMPI_Op_f2c(MPI_Fint op){
if(op==-1)
return MPI_OP_NULL;
- return static_cast<MPI_Op>(simgrid::smpi::Op::f2c(op));
+ return simgrid::smpi::Op::f2c(op);
}
MPI_Fint PMPI_Op_c2f(MPI_Op op){
MPI_Request PMPI_Request_f2c(MPI_Fint request){
if(request==-1)
return MPI_REQUEST_NULL;
- return static_cast<MPI_Request>(simgrid::smpi::Request::f2c(request));
+ return simgrid::smpi::Request::f2c(request);
}
MPI_Fint PMPI_Request_c2f(MPI_Request request) {
MPI_Win PMPI_Win_f2c(MPI_Fint win){
if(win==-1)
return MPI_WIN_NULL;
- return static_cast<MPI_Win>(simgrid::smpi::Win::f2c(win));
+ return simgrid::smpi::Win::f2c(win);
}
MPI_Fint PMPI_Win_c2f(MPI_Win win){
unsigned long long sec = static_cast<unsigned long long>(now);
unsigned long long pre = (now - sec) * smpi_rastro_resolution();
smpi_bench_begin();
- return static_cast<unsigned long long>(sec) * smpi_rastro_resolution() + pre;
+ return sec * smpi_rastro_resolution() + pre;
}
/* ****************************** Functions related to the SMPI_SAMPLE_ macros ************************************/
(static_cast<char*>(buff) < smpi_data_exe_start + smpi_data_exe_size)) {
XBT_DEBUG("Privatization : We are copying from a zone inside global memory... Saving data to temp buffer !");
smpi_switch_data_segment(comm->src_actor_->iface());
- tmpbuff = static_cast<void*>(xbt_malloc(buff_size));
+ tmpbuff = xbt_malloc(buff_size);
memcpy_private(tmpbuff, buff, private_blocks);
}
char key[KEY_SIZE];
return static_cast<MPI_Errhandler>(F2C::f2c_lookup()->at(get_key(key, id)));
} else {
- return static_cast<MPI_Errhandler>(MPI_ERRHANDLER_NULL);
+ return MPI_ERRHANDLER_NULL;
}
}
char key[KEY_SIZE];
return static_cast<MPI_Group>(F2C::f2c_lookup()->at(get_key(key, id)));
} else {
- return static_cast<MPI_Group>(MPI_GROUP_NULL);
+ return MPI_GROUP_NULL;
}
}
// This part handles the problem of non-contiguous memory (for the unserialization at the reception)
if ((((flags_ & MPI_REQ_RECV) != 0) && ((flags_ & MPI_REQ_ACCUMULATE) != 0)) || (old_type_->flags() & DT_FLAG_DERIVED)) {
// This part handles the problem of non-contiguous memory
- old_buf = const_cast<void*>(buf_);
+ old_buf = buf_;
if (count==0){
buf_ = nullptr;
}else {
wait(&requests[c],pstat);
index = c;
} else {
- index = waitany(count, (MPI_Request*)requests, pstat);
-
+ index = waitany(count, requests, pstat);
+
if (index == MPI_UNDEFINED)
break;
int index = 0;
MPI_Status stat;
MPI_Status *pstat = status == MPI_STATUSES_IGNORE ? MPI_STATUS_IGNORE : &stat;
- index = waitany(incount, (MPI_Request*)requests, pstat);
+ index = waitany(incount, requests, pstat);
if(index==MPI_UNDEFINED) return MPI_UNDEFINED;
if(status != MPI_STATUSES_IGNORE) {
status[count] = *pstat;
{
char key[KEY_SIZE];
if(id==MPI_FORTRAN_REQUEST_NULL)
- return static_cast<MPI_Request>(MPI_REQUEST_NULL);
+ return MPI_REQUEST_NULL;
return static_cast<MPI_Request>(F2C::f2c_lookup()->at(get_key(key,id)));
}
get_host()->turn_off();
while ((var = cnst->get_variable(&elem))) {
- auto* action = static_cast<Action*>(var->get_id());
+ Action* action = var->get_id();
if (action->get_state() == Action::State::INITED || action->get_state() == Action::State::STARTED ||
action->get_state() == Action::State::IGNORED) {
const kernel::lmm::Element* elem = nullptr;
double now = surf_get_clock();
while ((var = get_constraint()->get_variable(&elem))) {
- Action* action = static_cast<Action*>(var->get_id());
+ Action* action = var->get_id();
if (action->get_state() == Action::State::INITED || action->get_state() == Action::State::STARTED) {
action->set_finish_time(now);
action->set_state(Action::State::FAILED);
get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(), speed_.peak * speed_.scale);
while ((var = get_constraint()->get_variable(&elem))) {
- const kernel::resource::Action* action = static_cast<kernel::resource::Action*>(var->get_id());
+ const kernel::resource::Action* action = var->get_id();
get_model()->get_maxmin_system()->update_variable_bound(action->get_variable(), speed_.scale * speed_.peak);
}
linkUp = simgrid::s4u::Link::by_name_or_null(tmp_link);
linkDown = simgrid::s4u::Link::by_name_or_null(tmp_link);
- auto* as_cluster = static_cast<ClusterZone*>(current_as);
+ ClusterZone* as_cluster = current_as;
as_cluster->private_links_.insert({as_cluster->node_pos(rankId), {linkUp->get_impl(), linkDown->get_impl()}});
}
xbt_assert(current_routing, "Cannot seal the current AS: none under construction");
current_routing->seal();
simgrid::s4u::NetZone::on_seal(*current_routing->get_iface());
- current_routing = static_cast<simgrid::kernel::routing::NetZoneImpl*>(current_routing->get_father());
+ current_routing = current_routing->get_father();
}
/** @brief Add a link connecting a host to the rest of its AS (which must be cluster or vivaldi) */
*/
unsigned long xbt_dynar_length(const_xbt_dynar_t dynar)
{
- return (dynar ? (unsigned long) dynar->used : (unsigned long) 0);
+ return (dynar ? dynar->used : 0UL);
}
/**@brief check if a dynar is empty
_sanity_check_dynar(dynar);
for (i = 0; i < used; i++) {
- char* elm = (char*) data + i * elmsize;
+ char* elm = data + i * elmsize;
op(elm);
}
}
/* Mark all my ex-blocks as free */
for (it=0; it<mdp->heapinfo[block].busy_block.size; it++) {
if (mdp->heapinfo[block+it].type < 0) {
- fprintf(stderr,"Internal Error: Asked to free a block already marked as free (block=%lu it=%d type=%lu). Please report this bug.\n",
- (unsigned long)block,it,(unsigned long)mdp->heapinfo[block].type);
+ fprintf(stderr,
+ "Internal Error: Asked to free a block already marked as free (block=%zu it=%d type=%d). "
+ "Please report this bug.\n",
+ block, it, mdp->heapinfo[block].type);
abort();
}
mdp->heapinfo[block+it].type = MMALLOC_TYPE_FREE;
/* Mark all my ex-blocks as free */
for (it=0; it<mdp->heapinfo[block].free_block.size; it++) {
if (mdp->heapinfo[block+it].type <0) {
- fprintf(stderr,"Internal error: Asked to free a block already marked as free (block=%lu it=%d/%lu type=%lu). Please report this bug.\n",
- (unsigned long)block,it,(unsigned long)mdp->heapinfo[block].free_block.size,(unsigned long)mdp->heapinfo[block].type);
+ fprintf(stderr,
+ "Internal error: Asked to free a block already marked as free (block=%zu it=%d/%zu type=%d). "
+ "Please report this bug.\n",
+ block, it, mdp->heapinfo[block].free_block.size, mdp->heapinfo[block].type);
abort();
}
mdp->heapinfo[block+it].type = MMALLOC_TYPE_FREE;
mdp -> heapstats.chunks_free -= BLOCKSIZE >> type;
mdp -> heapstats.bytes_free -= BLOCKSIZE;
- mfree((void *) mdp, (void *) ADDRESS(block));
+ mfree(mdp, ADDRESS(block));
} else if (mdp->heapinfo[block].busy_frag.nfree != 0) {
/* If some fragments of this block are free, you know what? I'm already happy. */
++mdp->heapinfo[block].busy_frag.nfree;
block = MALLOC_SEARCH_START;
while (mdp->heapinfo[block].free_block.size < blocks) {
if (mdp->heapinfo[block].type >=0) { // Don't trust xbt_die and friends in malloc-level library, you fool!
- fprintf(stderr,"Internal error: found a free block not marked as such (block=%lu type=%lu). Please report this bug.\n",(unsigned long)block,(unsigned long)mdp->heapinfo[block].type);
+ fprintf(stderr,
+ "Internal error: found a free block not marked as such (block=%zu type=%d). Please report this bug.\n",
+ block, mdp->heapinfo[block].type);
abort();
}
/* We are deallocating memory. If the amount requested would cause us to try to deallocate back past the base of
* the mmap'd region then die verbosely. Otherwise, deallocate the memory and return the old break value. */
if (((char*)mdp->breakval) + size >= (char*)mdp->base) {
- result = (void*)mdp->breakval;
+ result = mdp->breakval;
mdp->breakval = (char*)mdp->breakval + size;
moveto = PAGE_ALIGN(mdp->breakval);
munmap(moveto, (size_t)(((char*)mdp->top) - ((char*)moveto)) - 1);
mdp->base = mdp->breakval = mapto;
mdp->top = PAGE_ALIGN((char*)mdp->breakval + size);
- result = (void *) mdp->breakval;
+ result = mdp->breakval;
mdp->breakval = (char*)mdp->breakval + size;
} else {
/* Memory is already mapped, we only need to increase the breakval: */
- result = (void *) mdp->breakval;
+ result = mdp->breakval;
mdp->breakval = (char*)mdp->breakval + size;
}
}
return (double) (time(NULL));
#endif /* HAVE_GETTIMEOFDAY? */
- return (double) (tv.tv_sec + tv.tv_usec / 1000000.0);
+ return tv.tv_sec + tv.tv_usec / 1000000.0;
}
void xbt_os_sleep(double sec)