memcpymask is a constant and thus should be uppercase

This commit is contained in:
Axel Kohlmeyer
2024-12-27 01:54:44 -05:00
parent 5ece81323e
commit 53c3fa2afd
6 changed files with 19 additions and 19 deletions

View File

@ -201,7 +201,7 @@ void AtomVecSMD::write_data_restricted_to_general()
int nlocal = atom->nlocal;
memory->create(x0_hold,nlocal,3,"atomvec:x0_hold");
if (nlocal) memcpy(&x0_hold[0][0],&x0[0][0],(3*nlocal*sizeof(double))&memcpymask);
if (nlocal) memcpy(&x0_hold[0][0],&x0[0][0],(3*nlocal*sizeof(double))&MEMCPYMASK);
for (int i = 0; i < nlocal; i++)
domain->restricted_to_general_coords(x0[i]);
@ -221,7 +221,7 @@ void AtomVecSMD::write_data_restore_restricted()
if (!x0_hold) return;
int nlocal = atom->nlocal;
memcpy(&x0[0][0],&x0_hold[0][0],(3*nlocal*sizeof(double))&memcpymask);
memcpy(&x0[0][0],&x0_hold[0][0],(3*nlocal*sizeof(double))&MEMCPYMASK);
memory->destroy(x0_hold);
x0_hold = nullptr;
}

View File

@ -770,9 +770,9 @@ void PRD::replicate(int ireplica)
int nlocal = atom->nlocal;
if (universe->iworld == ireplica) {
memcpy(tagall,tag,(nlocal*sizeof(tagint))&memcpymask);
memcpy(xall[0],x[0],(3*nlocal*sizeof(double))&memcpymask);
memcpy(imageall,image,(nlocal*sizeof(imageint))&memcpymask);
memcpy(tagall,tag,(nlocal*sizeof(tagint))&MEMCPYMASK);
memcpy(xall[0],x[0],(3*nlocal*sizeof(double))&MEMCPYMASK);
memcpy(imageall,image,(nlocal*sizeof(imageint))&MEMCPYMASK);
}
MPI_Bcast(tagall,natoms,MPI_LMP_TAGINT,ireplica,comm_replica);

View File

@ -2269,7 +2269,7 @@ void AtomVec::write_data_restricted_to_general()
int nlocal = atom->nlocal;
memory->create(x_hold,nlocal,3,"atomvec:x_hold");
if (nlocal) memcpy(&x_hold[0][0],&x[0][0],(3*nlocal*sizeof(double))&memcpymask);
if (nlocal) memcpy(&x_hold[0][0],&x[0][0],(3*nlocal*sizeof(double))&MEMCPYMASK);
for (int i = 0; i < nlocal; i++)
domain->restricted_to_general_coords(x[i]);
@ -2290,17 +2290,17 @@ void AtomVec::write_data_restricted_to_general()
if (array == v) {
memory->create(v_hold,nlocal,3,"atomvec:v_hold");
if (nlocal) memcpy(&v_hold[0][0],&v[0][0],(3*nlocal*sizeof(double))&memcpymask);
if (nlocal) memcpy(&v_hold[0][0],&v[0][0],(3*nlocal*sizeof(double))&MEMCPYMASK);
for (int i = 0; i < nlocal; i++)
domain->restricted_to_general_vector(v[i]);
} else if (array == omega) {
memory->create(omega_hold,nlocal,3,"atomvec:omega_hold");
if (nlocal) memcpy(&omega_hold[0][0],&omega[0][0],(3*nlocal*sizeof(double))&memcpymask);
if (nlocal) memcpy(&omega_hold[0][0],&omega[0][0],(3*nlocal*sizeof(double))&MEMCPYMASK);
for (int i = 0; i < nlocal; i++)
domain->restricted_to_general_vector(omega[i]);
} else if (array == angmom) {
memory->create(angmom_hold,nlocal,3,"atomvec:angmom_hold");
if (nlocal) memcpy(&angmom_hold[0][0],&angmom[0][0],(3*nlocal*sizeof(double))&memcpymask);
if (nlocal) memcpy(&angmom_hold[0][0],&angmom[0][0],(3*nlocal*sizeof(double))&MEMCPYMASK);
for (int i = 0; i < nlocal; i++)
domain->restricted_to_general_vector(angmom[i]);
}
@ -2321,7 +2321,7 @@ void AtomVec::write_data_restore_restricted()
int nlocal = atom->nlocal;
if (x_hold) {
memcpy(&x[0][0],&x_hold[0][0],(3*nlocal*sizeof(double))&memcpymask);
memcpy(&x[0][0],&x_hold[0][0],(3*nlocal*sizeof(double))&MEMCPYMASK);
memory->destroy(x_hold);
x_hold = nullptr;
}
@ -2330,19 +2330,19 @@ void AtomVec::write_data_restore_restricted()
// no other write_data Velocities fields are Nx3 double arrays
if (v_hold) {
memcpy(&v[0][0],&v_hold[0][0],(3*nlocal*sizeof(double))&memcpymask);
memcpy(&v[0][0],&v_hold[0][0],(3*nlocal*sizeof(double))&MEMCPYMASK);
memory->destroy(v_hold);
v_hold = nullptr;
}
if (omega_hold) {
memcpy(&atom->omega[0][0],&omega_hold[0][0],(3*nlocal*sizeof(double))&memcpymask);
memcpy(&atom->omega[0][0],&omega_hold[0][0],(3*nlocal*sizeof(double))&MEMCPYMASK);
memory->destroy(omega_hold);
omega_hold = nullptr;
}
if (angmom_hold) {
memcpy(&atom->angmom[0][0],&angmom_hold[0][0],(3*nlocal*sizeof(double))&memcpymask);
memcpy(&atom->angmom[0][0],&angmom_hold[0][0],(3*nlocal*sizeof(double))&MEMCPYMASK);
memory->destroy(angmom_hold);
angmom_hold = nullptr;
}

View File

@ -409,9 +409,9 @@ void Dump::write()
int nlocal = atom->nlocal;
if (nlocal > maxpbc) pbc_allocate();
if (nlocal) {
memcpy(&xpbc[0][0],&atom->x[0][0],(3*nlocal*sizeof(double))&memcpymask);
memcpy(&vpbc[0][0],&atom->v[0][0],(3*nlocal*sizeof(double))&memcpymask);
memcpy(imagepbc,atom->image,(nlocal*sizeof(imageint))&memcpymask);
memcpy(&xpbc[0][0],&atom->x[0][0],(3*nlocal*sizeof(double))&MEMCPYMASK);
memcpy(&vpbc[0][0],&atom->v[0][0],(3*nlocal*sizeof(double))&MEMCPYMASK);
memcpy(imagepbc,atom->image,(nlocal*sizeof(imageint))&MEMCPYMASK);
}
xhold = atom->x;
vhold = atom->v;

View File

@ -66,9 +66,9 @@ namespace LAMMPS_NS {
// mask to curb data sizes when calling memcpy() to avoid bogus compiler warnings
#if UINTPTR_MAX > (1UL<<63)
static constexpr uint64_t memcpymask = (static_cast<uint64_t>(1) << 63) - 1U;
static constexpr uint64_t MEMCPYMASK = (static_cast<uint64_t>(1) << 63) - 1U;
#else
static constexpr uint32_t memcpymask = (static_cast<uint32_t>(1) << 31) - 1U;
static constexpr uint32_t MEMCPYMASK = (static_cast<uint32_t>(1) << 31) - 1U;
#endif
// default to 32-bit smallint and other ints, 64-bit bigint

View File

@ -4739,7 +4739,7 @@ int Variable::special_function(const std::string &word, char *contents, Tree **t
double *result;
memory->create(result,atom->nlocal,"variable:result");
memcpy(result,reader[ivar]->fixstore->vstore,(atom->nlocal*sizeof(double))&memcpymask);
memcpy(result,reader[ivar]->fixstore->vstore,(atom->nlocal*sizeof(double))&MEMCPYMASK);
int done = reader[ivar]->read_peratom();
if (done) remove(ivar);