skip checks in statvis_calc_thickness(). also remove paranoid NULL checks in smallhash.c

This commit is contained in:
Campbell Barton
2013-04-20 16:49:02 +00:00
parent 106d41699a
commit 46b40e112b
2 changed files with 7 additions and 15 deletions

View File

@@ -1684,7 +1684,7 @@ static void statvis_calc_thickness(
#define FACE_RAY_TEST_ANGLE \
f_hit = BKE_bmbvh_ray_cast(bmtree, ray_co, ray_no, \
&dist, NULL, NULL); \
if (f_hit) { \
if (f_hit && dist < face_dists[index]) { \
float angle_fac = fabsf(dot_v3v3(ltri[0]->f->no, f_hit->no)); \
angle_fac = 1.0f - angle_fac; \
angle_fac = angle_fac * angle_fac * angle_fac; \

View File

@@ -43,6 +43,10 @@
#define SMHASH_CELL_UNUSED ((void *)0x7FFFFFFF)
#define SMHASH_CELL_FREE ((void *)0x7FFFFFFD)
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wstrict-overflow"
#endif
BLI_INLINE int smhash_nonzero(const int n)
{
return n + !n;
@@ -83,10 +87,6 @@ void BLI_smallhash_init(SmallHash *hash)
/*NOTE: does *not* free *hash itself! only the direct data!*/
void BLI_smallhash_release(SmallHash *hash)
{
if (hash == NULL) {
return;
}
if (hash->table != hash->stacktable) {
MEM_freeN(hash->table);
}
@@ -181,10 +181,6 @@ void *BLI_smallhash_lookup(SmallHash *hash, uintptr_t key)
h = ABS((int)key);
if (hash->table == NULL) {
return NULL;
}
while ((hash->table[h % hash->size].key != key) ||
(hash->table[h % hash->size].val == SMHASH_CELL_UNUSED))
{
@@ -209,10 +205,6 @@ int BLI_smallhash_haskey(SmallHash *hash, uintptr_t key)
int h = ABS((int)key);
int hoff = 1;
if (hash->table == NULL) {
return 0;
}
while ((hash->table[h % hash->size].key != key) ||
(hash->table[h % hash->size].val == SMHASH_CELL_UNUSED))
{