commit 04a43211fe780f654295763b8130c63600ee3e46
parent 5497482732cdfe86eec88416fb2b9077533eb5f0
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Tue, 2 Mar 2021 15:46:10 +0100
Fix spacing
Diffstat:
2 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/src/ssp_ran.c b/src/ssp_ran.c
@@ -200,7 +200,7 @@ ssp_ran_sphere_uniform_float
sample[0] = cosf(phi) * sin_theta;
sample[1] = sinf(phi) * sin_theta;
sample[2] = cos_theta;
- if (pdf) *pdf = 1 / (4*(float)PI);
+ if(pdf) *pdf = 1 / (4*(float)PI);
return sample;
}
@@ -258,7 +258,7 @@ ssp_ran_triangle_uniform
sample[0] = v2[0] + one_minus_u * vec0[0] + v * sqrt_u * vec1[0];
sample[1] = v2[1] + one_minus_u * vec0[1] + v * sqrt_u * vec1[1];
sample[2] = v2[2] + one_minus_u * vec0[2] + v * sqrt_u * vec1[2];
- if (pdf) *pdf = 2 / d3_len(d3_cross(tmp, vec0, vec1));
+ if(pdf) *pdf = 2 / d3_len(d3_cross(tmp, vec0, vec1));
return sample;
}
@@ -286,7 +286,7 @@ ssp_ran_triangle_uniform_float
sample[0] = v2[0] + one_minus_u * vec0[0] + v * sqrt_u * vec1[0];
sample[1] = v2[1] + one_minus_u * vec0[1] + v * sqrt_u * vec1[1];
sample[2] = v2[2] + one_minus_u * vec0[2] + v * sqrt_u * vec1[2];
- if (pdf) *pdf = 2 / f3_len(f3_cross(tmp, vec0, vec1));
+ if(pdf) *pdf = 2 / f3_len(f3_cross(tmp, vec0, vec1));
return sample;
}
@@ -308,16 +308,16 @@ ssp_ran_tetrahedron_uniform
t = ssp_rng_canonical(rng);
u = ssp_rng_canonical(rng);
- if (s + t > 1) { /* Cut and fold the cube into a prism */
+ if(s + t > 1) { /* Cut and fold the cube into a prism */
s = 1 - s;
t = 1 - t;
}
- if (t + u > 1) { /* Cut and fold the prism into a tetrahedron */
+ if(t + u > 1) { /* Cut and fold the prism into a tetrahedron */
double swp = u;
u = 1 - s - t;
t = 1 - swp;
}
- else if (s + t + u > 1) {
+ else if(s + t + u > 1) {
double swp = u;
u = s + t + u - 1;
s = 1 - t - swp;
@@ -328,7 +328,7 @@ ssp_ran_tetrahedron_uniform
d3_add(tmp4, d3_muld(tmp0, v0, a), d3_muld(tmp1, v1, s)),
d3_add(tmp5, d3_muld(tmp2, v2, t), d3_muld(tmp3, v3, u)));
- if (pdf)
+ if(pdf)
*pdf = ssp_ran_tetrahedron_uniform_pdf(v0, v1, v2, v3);
return sample;
@@ -352,16 +352,16 @@ ssp_ran_tetrahedron_uniform_float
t = ssp_rng_canonical_float(rng);
u = ssp_rng_canonical_float(rng);
- if (s + t > 1) { /* Cut and fold the cube into a prism */
+ if(s + t > 1) { /* Cut and fold the cube into a prism */
s = 1 - s;
t = 1 - t;
}
- if (t + u > 1) { /* Cut and fold the prism into a tetrahedron */
+ if(t + u > 1) { /* Cut and fold the prism into a tetrahedron */
float swp = u;
u = 1 - s - t;
t = 1 - swp;
}
- else if (s + t + u > 1) {
+ else if(s + t + u > 1) {
float swp = u;
u = s + t + u - 1;
s = 1 - t - swp;
@@ -372,7 +372,7 @@ ssp_ran_tetrahedron_uniform_float
f3_add(tmp4, f3_mulf(tmp0, v0, a), f3_mulf(tmp1, v1, s)),
f3_add(tmp5, f3_mulf(tmp2, v2, t), f3_mulf(tmp3, v3, u)));
- if (pdf)
+ if(pdf)
*pdf = ssp_ran_tetrahedron_uniform_float_pdf(v0, v1, v2, v3);
return sample;
@@ -392,7 +392,7 @@ ssp_ran_hemisphere_uniform_local
sample[0] = cos(phi) * sin_theta;
sample[1] = sin(phi) * sin_theta;
sample[2] = cos_theta;
- if (pdf) *pdf = 1 / (2*PI);
+ if(pdf) *pdf = 1 / (2*PI);
return sample;
}
@@ -410,7 +410,7 @@ ssp_ran_hemisphere_uniform_float_local
sample[0] = cosf(phi) * sin_theta;
sample[1] = sinf(phi) * sin_theta;
sample[2] = cos_theta;
- if (pdf) *pdf = 1 / (2*(float)PI);
+ if(pdf) *pdf = 1 / (2*(float)PI);
return sample;
}
@@ -429,7 +429,7 @@ ssp_ran_hemisphere_cos_local
sample[0] = cos(phi) * sin_theta;
sample[1] = sin(phi) * sin_theta;
sample[2] = cos_theta;
- if (pdf) *pdf = cos_theta / PI;
+ if(pdf) *pdf = cos_theta / PI;
return sample;
}
@@ -448,7 +448,7 @@ ssp_ran_hemisphere_cos_float_local
sample[0] = cosf(phi) * sin_theta;
sample[1] = sinf(phi) * sin_theta;
sample[2] = cos_theta;
- if (pdf) *pdf = cos_theta / (float)PI;
+ if(pdf) *pdf = cos_theta / (float)PI;
return sample;
}
@@ -600,7 +600,7 @@ ssp_ran_uniform_disk_local
pt[0] = r * cos(theta);
pt[1] = r * sin(theta);
pt[2] = 0;
- if (pdf) *pdf = 1 / (radius * radius);
+ if(pdf) *pdf = 1 / (radius * radius);
return pt;
}
@@ -618,7 +618,7 @@ ssp_ran_uniform_disk_float_local
pt[0] = r * cosf(theta);
pt[1] = r * sinf(theta);
pt[2] = 0;
- if (pdf) *pdf = 1 / (radius * radius);
+ if(pdf) *pdf = 1 / (radius * radius);
return pt;
}
diff --git a/src/ssp_rng.c b/src/ssp_rng.c
@@ -472,7 +472,7 @@ rng_cxx_init<aes_T>(struct mem_allocator* allocator, void* data)
{
(void) allocator;
- if (!haveAESNI()) {
+ if(!haveAESNI()) {
/* AES-NI instructions not available on this hardware */
return RES_BAD_OP;
}
@@ -544,7 +544,7 @@ rng_release(ref_T* ref)
ASSERT(ref);
rng = CONTAINER_OF(ref, struct ssp_rng, ref);
if(rng->state) {
- if (rng->type.release) {
+ if(rng->type.release) {
rng->type.release(rng->state);
}
MEM_RM(rng->allocator, rng->state);
@@ -774,13 +774,13 @@ ssp_rng_write_cstr
double
ssp_rng_entropy(const struct ssp_rng* rng)
{
- if (!rng) FATAL("The Random Number Generator is NULL\n");
+ if(!rng) FATAL("The Random Number Generator is NULL\n");
return rng->type.entropy(rng->state);
}
res_T
ssp_rng_discard(struct ssp_rng* rng, uint64_t n)
{
- if (!rng) FATAL("The Random Number Generator is NULL\n");
+ if(!rng) FATAL("The Random Number Generator is NULL\n");
return rng->type.discard(rng->state, n);
}