Commit e0767822 authored by Célestin Marot's avatar Célestin Marot
Browse files

easier to return directly index

parent 758fb9d8
......@@ -125,11 +125,10 @@ static inline void increment_3valences(SPRCavity* SPR,
}
static inline void get_compressed_index(unsigned v0,
unsigned v1,
unsigned v2,
unsigned v3,
unsigned* index)
static inline unsigned get_compressed_index(unsigned v0,
unsigned v1,
unsigned v2,
unsigned v3)
{
#define SPRSWAP(x,y) if(x>y){unsigned tmp=x; x=y; y=tmp;}
SPRSWAP(v0,v1)
......@@ -140,7 +139,7 @@ static inline void get_compressed_index(unsigned v0,
#undef SPRSWAP
unsigned aux = v3*(v3-3);
*index = v0 + (v1*(v1-1)>>1) + v2*(v2-1)*(v2-2)/6 + aux*(aux+2)/24;
return v0 + (v1*(v1-1)>>1) + v2*(v2-1)*(v2-2)/6 + aux*(aux+2)/24;
// *index = v0 + v1*(v1-1)/2 + v2*(v2-1)*(v2-2)/6 + v3*(v3-1)*(v3-2)*(v3-3)/24;
}
......@@ -680,9 +679,7 @@ static double get_quality_map(SPRCavity* SPR,
else if(SPR->quality.function==NULL)
return 1.0;
unsigned index;
get_compressed_index(v0, v1, v2, v3, &index);
unsigned index = get_compressed_index(v0, v1, v2, v3);
double qual = SPR->map.qualities[index];
if(!isnan(qual)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment