3434#include <inttypes.h>
3535#endif
3636
37-
3837#if __GNUC_GNU_INLINE__ && !defined(__cplusplus )
3938#error Nonstandard GNU inlining semantics. Compile with -std=c99 or better.
4039#endif
@@ -53,7 +52,7 @@ extern "C" {
5352 uint64_t low ;
5453 } pcg128_t ;
5554
56- inline pcg128_t PCG_128BIT_CONSTANT (uint64_t high , uint64_t low ) {
55+ static inline pcg128_t PCG_128BIT_CONSTANT (uint64_t high , uint64_t low ) {
5756 pcg128_t result ;
5857 result .high = high ;
5958 result .low = low ;
@@ -80,22 +79,22 @@ extern "C" {
8079 { PCG_128BIT_CONSTANT(0x979c9a98d8462005ULL, 0x7d3e9cb6cfe0549bULL), \
8180 PCG_128BIT_CONSTANT(0x0000000000000001ULL, 0xda3e39cb94b95bdbULL) }
8281
83- inline uint64_t pcg_rotr_64 (uint64_t value , unsigned int rot )
82+ static inline uint64_t pcg_rotr_64 (uint64_t value , unsigned int rot )
8483 {
8584 return (value >> rot ) | (value << ((- rot ) & 63 ));
8685 }
8786
8887#ifdef PCG_EMULATED_128BIT_MATH
8988
90- inline pcg128_t _pcg128_add (pcg128_t a , pcg128_t b ) {
89+ static inline pcg128_t _pcg128_add (pcg128_t a , pcg128_t b ) {
9190 pcg128_t result ;
9291
9392 result .low = a .low + b .low ;
9493 result .high = a .high + b .high + (result .low < b .low );
9594 return result ;
9695 }
9796
98- inline void _pcg_mult64 (uint64_t x , uint64_t y , uint64_t * z1 , uint64_t * z0 ) {
97+ static inline void _pcg_mult64 (uint64_t x , uint64_t y , uint64_t * z1 , uint64_t * z0 ) {
9998 uint64_t x0 , x1 , y0 , y1 ;
10099 uint64_t w0 , w1 , w2 , t ;
101100 /* Lower 64 bits are straightforward clock-arithmetic. */
@@ -113,7 +112,7 @@ extern "C" {
113112 * z1 = x1 * y1 + w2 + (w1 >> 32 );
114113 }
115114
116- inline pcg128_t _pcg128_mult (pcg128_t a , pcg128_t b ) {
115+ static inline pcg128_t _pcg128_mult (pcg128_t a , pcg128_t b ) {
117116 uint64_t h1 ;
118117 pcg128_t result ;
119118
@@ -123,18 +122,18 @@ extern "C" {
123122 return result ;
124123 }
125124
126- inline void pcg_setseq_128_step_r (pcg_state_setseq_128 * rng )
125+ static inline void pcg_setseq_128_step_r (pcg_state_setseq_128 * rng )
127126 {
128127 rng -> state = _pcg128_add (_pcg128_mult (rng -> state , PCG_DEFAULT_MULTIPLIER_128 ), rng -> inc );
129128 }
130129
131- inline uint64_t pcg_output_xsl_rr_128_64 (pcg128_t state )
130+ static inline uint64_t pcg_output_xsl_rr_128_64 (pcg128_t state )
132131 {
133132 return pcg_rotr_64 (state .high ^ state .low ,
134133 state .high >> 58u );
135134 }
136135
137- inline void pcg_setseq_128_srandom_r (pcg_state_setseq_128 * rng ,
136+ static inline void pcg_setseq_128_srandom_r (pcg_state_setseq_128 * rng ,
138137 pcg128_t initstate , pcg128_t initseq )
139138 {
140139 rng -> state = PCG_128BIT_CONSTANT (0ULL , 0ULL );
@@ -148,18 +147,18 @@ extern "C" {
148147
149148#else /* PCG_EMULATED_128BIT_MATH */
150149
151- inline void pcg_setseq_128_step_r (pcg_state_setseq_128 * rng )
150+ static inline void pcg_setseq_128_step_r (pcg_state_setseq_128 * rng )
152151 {
153152 rng -> state = rng -> state * PCG_DEFAULT_MULTIPLIER_128 + rng -> inc ;
154153 }
155154
156- inline uint64_t pcg_output_xsl_rr_128_64 (pcg128_t state )
155+ static inline uint64_t pcg_output_xsl_rr_128_64 (pcg128_t state )
157156 {
158157 return pcg_rotr_64 (((uint64_t )(state >> 64u )) ^ (uint64_t )state ,
159158 state >> 122u );
160159 }
161160
162- inline void pcg_setseq_128_srandom_r (pcg_state_setseq_128 * rng ,
161+ static inline void pcg_setseq_128_srandom_r (pcg_state_setseq_128 * rng ,
163162 pcg128_t initstate , pcg128_t initseq )
164163 {
165164 rng -> state = 0U ;
@@ -172,14 +171,14 @@ extern "C" {
172171#endif /* PCG_EMULATED_128BIT_MATH */
173172
174173
175- inline uint64_t
174+ static inline uint64_t
176175 pcg_setseq_128_xsl_rr_64_random_r (pcg_state_setseq_128 * rng )
177176 {
178177 pcg_setseq_128_step_r (rng );
179178 return pcg_output_xsl_rr_128_64 (rng -> state );
180179 }
181180
182- inline uint64_t
181+ static inline uint64_t
183182 pcg_setseq_128_xsl_rr_64_boundedrand_r (pcg_state_setseq_128 * rng ,
184183 uint64_t bound )
185184 {
@@ -194,7 +193,7 @@ extern "C" {
194193 extern pcg128_t pcg_advance_lcg_128 (pcg128_t state , pcg128_t delta , pcg128_t cur_mult ,
195194 pcg128_t cur_plus );
196195
197- inline void pcg_setseq_128_advance_r (pcg_state_setseq_128 * rng , pcg128_t delta )
196+ static inline void pcg_setseq_128_advance_r (pcg_state_setseq_128 * rng , pcg128_t delta )
198197 {
199198 rng -> state = pcg_advance_lcg_128 (rng -> state , delta ,
200199 PCG_DEFAULT_MULTIPLIER_128 , rng -> inc );
@@ -211,4 +210,4 @@ extern "C" {
211210 }
212211#endif
213212
214- #endif /* PCG64_H_INCLUDED */
213+ #endif /* PCG64_H_INCLUDED */
0 commit comments