skip checks in statvis_calc_thickness(). also remove paranoid NULL checks in smallhash.c
This commit is contained in:
@@ -1684,7 +1684,7 @@ static void statvis_calc_thickness(
|
|||||||
#define FACE_RAY_TEST_ANGLE \
|
#define FACE_RAY_TEST_ANGLE \
|
||||||
f_hit = BKE_bmbvh_ray_cast(bmtree, ray_co, ray_no, \
|
f_hit = BKE_bmbvh_ray_cast(bmtree, ray_co, ray_no, \
|
||||||
&dist, NULL, NULL); \
|
&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)); \
|
float angle_fac = fabsf(dot_v3v3(ltri[0]->f->no, f_hit->no)); \
|
||||||
angle_fac = 1.0f - angle_fac; \
|
angle_fac = 1.0f - angle_fac; \
|
||||||
angle_fac = angle_fac * angle_fac * angle_fac; \
|
angle_fac = angle_fac * angle_fac * angle_fac; \
|
||||||
|
@@ -43,6 +43,10 @@
|
|||||||
#define SMHASH_CELL_UNUSED ((void *)0x7FFFFFFF)
|
#define SMHASH_CELL_UNUSED ((void *)0x7FFFFFFF)
|
||||||
#define SMHASH_CELL_FREE ((void *)0x7FFFFFFD)
|
#define SMHASH_CELL_FREE ((void *)0x7FFFFFFD)
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
# pragma GCC diagnostic ignored "-Wstrict-overflow"
|
||||||
|
#endif
|
||||||
|
|
||||||
BLI_INLINE int smhash_nonzero(const int n)
|
BLI_INLINE int smhash_nonzero(const int n)
|
||||||
{
|
{
|
||||||
return n + !n;
|
return n + !n;
|
||||||
@@ -83,10 +87,6 @@ void BLI_smallhash_init(SmallHash *hash)
|
|||||||
/*NOTE: does *not* free *hash itself! only the direct data!*/
|
/*NOTE: does *not* free *hash itself! only the direct data!*/
|
||||||
void BLI_smallhash_release(SmallHash *hash)
|
void BLI_smallhash_release(SmallHash *hash)
|
||||||
{
|
{
|
||||||
if (hash == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hash->table != hash->stacktable) {
|
if (hash->table != hash->stacktable) {
|
||||||
MEM_freeN(hash->table);
|
MEM_freeN(hash->table);
|
||||||
}
|
}
|
||||||
@@ -181,10 +181,6 @@ void *BLI_smallhash_lookup(SmallHash *hash, uintptr_t key)
|
|||||||
|
|
||||||
h = ABS((int)key);
|
h = ABS((int)key);
|
||||||
|
|
||||||
if (hash->table == NULL) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((hash->table[h % hash->size].key != key) ||
|
while ((hash->table[h % hash->size].key != key) ||
|
||||||
(hash->table[h % hash->size].val == SMHASH_CELL_UNUSED))
|
(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 h = ABS((int)key);
|
||||||
int hoff = 1;
|
int hoff = 1;
|
||||||
|
|
||||||
if (hash->table == NULL) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((hash->table[h % hash->size].key != key) ||
|
while ((hash->table[h % hash->size].key != key) ||
|
||||||
(hash->table[h % hash->size].val == SMHASH_CELL_UNUSED))
|
(hash->table[h % hash->size].val == SMHASH_CELL_UNUSED))
|
||||||
{
|
{
|
||||||
@@ -234,7 +226,7 @@ int BLI_smallhash_count(SmallHash *hash)
|
|||||||
void *BLI_smallhash_iternext(SmallHashIter *iter, uintptr_t *key)
|
void *BLI_smallhash_iternext(SmallHashIter *iter, uintptr_t *key)
|
||||||
{
|
{
|
||||||
while (iter->i < iter->hash->size) {
|
while (iter->i < iter->hash->size) {
|
||||||
if ( (iter->hash->table[iter->i].val != SMHASH_CELL_UNUSED) &&
|
if ((iter->hash->table[iter->i].val != SMHASH_CELL_UNUSED) &&
|
||||||
(iter->hash->table[iter->i].val != SMHASH_CELL_FREE))
|
(iter->hash->table[iter->i].val != SMHASH_CELL_FREE))
|
||||||
{
|
{
|
||||||
if (key) {
|
if (key) {
|
||||||
|
Reference in New Issue
Block a user