diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/blenlib/BLI_rand.h | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/blenlib/BLI_rand.h')
-rw-r--r-- | source/blender/blenlib/BLI_rand.h | 55 |
1 files changed, 31 insertions, 24 deletions
diff --git a/source/blender/blenlib/BLI_rand.h b/source/blender/blenlib/BLI_rand.h index b76dadd9ad1..151b02a33aa 100644 --- a/source/blender/blenlib/BLI_rand.h +++ b/source/blender/blenlib/BLI_rand.h @@ -38,54 +38,61 @@ typedef struct RNG_THREAD_ARRAY RNG_THREAD_ARRAY; struct RNG *BLI_rng_new(unsigned int seed); struct RNG *BLI_rng_new_srandom(unsigned int seed); struct RNG *BLI_rng_copy(struct RNG *rng) ATTR_NONNULL(1); -void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1); +void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1); -void BLI_rng_seed(struct RNG *rng, unsigned int seed) ATTR_NONNULL(1); -void BLI_rng_srandom(struct RNG *rng, unsigned int seed) ATTR_NONNULL(1); -void BLI_rng_get_char_n(RNG *rng, char *bytes, size_t bytes_len) ATTR_NONNULL(1, 2); -int BLI_rng_get_int(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); +void BLI_rng_seed(struct RNG *rng, unsigned int seed) ATTR_NONNULL(1); +void BLI_rng_srandom(struct RNG *rng, unsigned int seed) ATTR_NONNULL(1); +void BLI_rng_get_char_n(RNG *rng, char *bytes, size_t bytes_len) ATTR_NONNULL(1, 2); +int BLI_rng_get_int(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); unsigned int BLI_rng_get_uint(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); -double BLI_rng_get_double(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); -float BLI_rng_get_float(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); -void BLI_rng_get_float_unit_v2(struct RNG *rng, float v[2]) ATTR_NONNULL(1, 2); -void BLI_rng_get_float_unit_v3(struct RNG *rng, float v[3]) ATTR_NONNULL(1, 2); -void BLI_rng_get_tri_sample_float_v2( - struct RNG *rng, const float v1[2], const float v2[2], const float v3[2], - float r_pt[2]) ATTR_NONNULL(); -void BLI_rng_shuffle_array(struct RNG *rng, void *data, unsigned int elem_size_i, unsigned int elem_tot) ATTR_NONNULL(1, 2); +double BLI_rng_get_double(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); +float BLI_rng_get_float(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); +void BLI_rng_get_float_unit_v2(struct RNG *rng, float v[2]) ATTR_NONNULL(1, 2); +void BLI_rng_get_float_unit_v3(struct RNG *rng, float v[3]) ATTR_NONNULL(1, 2); +void BLI_rng_get_tri_sample_float_v2(struct RNG *rng, + const float v1[2], + const float v2[2], + const float v3[2], + float r_pt[2]) ATTR_NONNULL(); +void BLI_rng_shuffle_array(struct RNG *rng, + void *data, + unsigned int elem_size_i, + unsigned int elem_tot) ATTR_NONNULL(1, 2); /** Note that skipping is as slow as generating n numbers! */ -void BLI_rng_skip(struct RNG *rng, int n) ATTR_NONNULL(1); +void BLI_rng_skip(struct RNG *rng, int n) ATTR_NONNULL(1); /* fill an array with random numbers */ -void BLI_array_frand(float *ar, int count, unsigned int seed); +void BLI_array_frand(float *ar, int count, unsigned int seed); /** Return a pseudo-random (hash) float from an integer value */ -float BLI_hash_frand(unsigned int seed) ATTR_WARN_UNUSED_RESULT; +float BLI_hash_frand(unsigned int seed) ATTR_WARN_UNUSED_RESULT; /** Shuffle an array randomly using the given seed. * contents. This routine does not use nor modify * the state of the BLI random number generator. */ -void BLI_array_randomize(void *data, unsigned int elem_size, unsigned int elem_tot, unsigned int seed); - +void BLI_array_randomize(void *data, + unsigned int elem_size, + unsigned int elem_tot, + unsigned int seed); /** Better seed for the random number generator, using noise.c hash[] */ /** Allows up to BLENDER_MAX_THREADS threads to address */ -void BLI_thread_srandom(int thread, unsigned int seed); +void BLI_thread_srandom(int thread, unsigned int seed); /** Return a pseudo-random number N where 0<=N<(2^31) */ /** Allows up to BLENDER_MAX_THREADS threads to address */ -int BLI_thread_rand(int thread) ATTR_WARN_UNUSED_RESULT; +int BLI_thread_rand(int thread) ATTR_WARN_UNUSED_RESULT; /** Return a pseudo-random number N where 0.0f<=N<1.0f */ /** Allows up to BLENDER_MAX_THREADS threads to address */ -float BLI_thread_frand(int thread) ATTR_WARN_UNUSED_RESULT; +float BLI_thread_frand(int thread) ATTR_WARN_UNUSED_RESULT; /** array versions for thread safe random generation */ RNG_THREAD_ARRAY *BLI_rng_threaded_new(void); -void BLI_rng_threaded_free(struct RNG_THREAD_ARRAY *rngarr) ATTR_NONNULL(1); -int BLI_rng_thread_rand(RNG_THREAD_ARRAY *rngarr, int thread) ATTR_WARN_UNUSED_RESULT; +void BLI_rng_threaded_free(struct RNG_THREAD_ARRAY *rngarr) ATTR_NONNULL(1); +int BLI_rng_thread_rand(RNG_THREAD_ARRAY *rngarr, int thread) ATTR_WARN_UNUSED_RESULT; /* Low-discrepancy sequences. */ @@ -99,4 +106,4 @@ void BLI_hammersley_1d(unsigned int n, double *r); void BLI_halton_2d_sequence(unsigned int prime[2], double offset[2], int n, double *r); void BLI_hammersley_2d_sequence(unsigned int n, double *r); -#endif /* __BLI_RAND_H__ */ +#endif /* __BLI_RAND_H__ */ |