Skip to content

Commit

Permalink
Modification of the fix introduced by de3046f to remove compiler warn…
Browse files Browse the repository at this point in the history
…ings.
  • Loading branch information
Algiane committed Mar 5, 2024
1 parent 5788cf5 commit 1ba5254
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 49 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,14 @@ ENDIF ()
SET (MMG5_INT "int32_t" CACHE STRING "Integer type")
IF (${MMG5_INT} STREQUAL "int64_t")
SET ( DEF_MMG5_INT "#define MMG5_int int64_t")
SET ( DEF_MMG5_INTMAX "#define MMG5_INTMAX LONG_MAX" )
SET ( DEF_MMG5_PRId "#define MMG5_PRId PRId64")
SET ( DEF_MMG5F_INT "#define MMG5F_INT SELECTED_INT_KIND(18)")
SET ( DEF_MMG_SWPBIN "#define MMG5_SWAPBIN(x) MMG5_swapbin_int(x)")
SET ( DEF_MMG_ABS "#define MMG5_abs(x) (int64_t)labs((int64_t)x)")
ELSE ()
SET ( DEF_MMG5_INT "#define MMG5_int int32_t")
SET ( DEF_MMG5_INTMAX "#define MMG5_INTMAX INT_MAX" )
SET ( DEF_MMG5_PRId "#define MMG5_PRId PRId32")
SET ( DEF_MMG5F_INT "#define MMG5F_INT SELECTED_INT_KIND(9)")
SET ( DEF_MMG_SWPBIN "#define MMG5_SWAPBIN(x) MMG5_swapbin(x)")
Expand Down
7 changes: 1 addition & 6 deletions src/common/mmg2.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,7 @@ int MMG5_MultiMat_init(MMG5_pMesh mesh) {
/* Initialize the max and min reference */
refmax = 0;

if ( sizeof(MMG5_int) == 8 ) {
refmin = LONG_MAX;
}
else {
refmin = INT_MAX;
}
refmin = MMG5_INTMAX;

/* Look for the max/min reference provided in material table */
for( k = 0; k < mesh->info.nmat; k++ ) {
Expand Down
2 changes: 2 additions & 0 deletions src/common/mmgcmakedefines.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

@DEF_MMG5_INT@ /*!< Integer type for C */

@DEF_MMG5_INTMAX@ /*!< INT_MAX or LONG_MAX depending on MMG5_INT size */

@DEF_MMG5_PRId@ /*!< Printing format for MMG5_int type */

@DEF_MMG_SWPBIN@ /*!< MMG5_swapbin function for MMG5_int */
Expand Down
8 changes: 1 addition & 7 deletions src/mmg2d/API_functions_2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,7 @@ int MMG2D_Set_iparameter(MMG5_pMesh mesh, MMG5_pSol sol, int iparam, MMG5_int va
return 0);
MMG5_SAFE_CALLOC(mesh->info.par,mesh->info.npar,MMG5_Par,return 0);

MMG5_int inival;
if ( sizeof(MMG5_int) == 8 ) {
inival = LONG_MAX;
}
else {
inival = INT_MAX;
}
MMG5_int inival = MMG5_INTMAX;

for (k=0; k<mesh->info.npar; k++) {
mesh->info.par[k].elt = MMG5_Noentity;
Expand Down
14 changes: 2 additions & 12 deletions src/mmg2d/hash_2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,7 @@ int MMG2D_hashTria(MMG5_pMesh mesh) {
hsize = mesh->nt;

/* init */
if ( sizeof(MMG5_int) == 8 ) {
inival = LONG_MAX;
}
else {
inival = INT_MAX;
}
inival = MMG5_INTMAX;

for (k=0; k<=mesh->nt; k++)
hcode[k] = -inival;
Expand Down Expand Up @@ -192,12 +187,7 @@ int MMG2D_hashQuad(MMG5_pMesh mesh) {
/* init */
if ( mesh->info.ddebug ) fprintf(stdout," h- stage 1: init\n");

if ( sizeof(MMG5_int) == 8 ) {
inival = LONG_MAX;
}
else {
inival = INT_MAX;
}
inival = MMG5_INTMAX;

iadr = 0;
for (k=0; k<=mesh->nquad; k++)
Expand Down
7 changes: 1 addition & 6 deletions src/mmg3d/API_functions_3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -2235,12 +2235,7 @@ int MMG3D_Set_iparameter(MMG5_pMesh mesh, MMG5_pSol sol, int iparam,MMG5_int val
MMG5_SAFE_CALLOC(mesh->info.par,mesh->info.npar,MMG5_Par,return 0);

MMG5_int inival;
if ( sizeof(MMG5_int) == 8 ) {
inival = LONG_MAX;
}
else {
inival = INT_MAX;
}
inival = MMG5_INTMAX;

for (k=0; k<mesh->info.npar; k++) {
mesh->info.par[k].elt = MMG5_Noentity;
Expand Down
14 changes: 2 additions & 12 deletions src/mmg3d/hash_3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,7 @@ int MMG3D_hashTetra(MMG5_pMesh mesh, int pack) {
/* init */
if ( mesh->info.ddebug ) fprintf(stdout," h- stage 1: init\n");

if ( sizeof(MMG5_int) == 8 ) {
inival = LONG_MAX;
}
else {
inival = INT_MAX;
}
inival = MMG5_INTMAX;

iadr = 0;
for (k=0; k<=mesh->ne; k++)
Expand Down Expand Up @@ -278,12 +273,7 @@ int MMG3D_hashPrism(MMG5_pMesh mesh) {
/* init */
if ( mesh->info.ddebug ) fprintf(stdout," h- stage 1: init\n");

if ( sizeof(MMG5_int) == 8 ) {
inival = LONG_MAX;
}
else {
inival = INT_MAX;
}
inival = MMG5_INTMAX;

iadr = 0;
for (k=0; k<=mesh->nprism; k++)
Expand Down
7 changes: 1 addition & 6 deletions src/mmgs/API_functions_s.c
Original file line number Diff line number Diff line change
Expand Up @@ -1394,12 +1394,7 @@ int MMGS_Set_iparameter(MMG5_pMesh mesh, MMG5_pSol sol, int iparam, MMG5_int val
MMG5_SAFE_CALLOC(mesh->info.par,mesh->info.npar,MMG5_Par,return 0);

MMG5_int inival;
if ( sizeof(MMG5_int) == 8 ) {
inival = LONG_MAX;
}
else {
inival = INT_MAX;
}
inival = MMG5_INTMAX;

for (k=0; k<mesh->info.npar; k++) {
mesh->info.par[k].elt = MMG5_Noentity;
Expand Down

0 comments on commit 1ba5254

Please sign in to comment.