33 * SPDX-License-Identifier: BSD-3-Clause */
44#include "../include/pgm_random.h"
55
6- #if defined(__GNUC__ ) || defined(__clang__ )
6+ #if defined(_MSC_VER )
7+ #define PGM_INLINE __inline
8+ #elif defined(__GNUC__ ) || defined(__clang__ )
79 #define PGM_INLINE inline
810#else
911 #define PGM_INLINE
@@ -28,13 +30,13 @@ random_polyagamma_saddle(bitgen_t* bitgen_state, double h, double z,
2830
2931/* libc math library forward declarations */
3032double
31- sinh (double __x );
33+ sinh (double x );
3234double
33- tanh (double __x );
35+ tanh (double x );
3436double
35- sqrt (double __x );
37+ sqrt (double x );
3638double
37- fabs (double __x );
39+ fabs (double x );
3840
3941/*
4042 * Sample from a PG(h. z) using a Normal Approximation. For sufficiently large
@@ -72,7 +74,7 @@ random_polyagamma_normal_approx(bitgen_t* bitgen_state, double h, double z,
7274#endif
7375
7476void *
75- memset (void * __s , int __c , size_t __n );
77+ memset (void * s , int c , size_t n );
7678/*
7779 * Sample from PG(h, z) using the Gamma convolution approximation method.
7880 *
@@ -126,7 +128,7 @@ random_polyagamma_hybrid(bitgen_t* bitgen_state, double h, double z,
126128typedef void
127129(* pgm_func_t )(bitgen_t * bitgen_state , double h , double z , size_t n , double * out );
128130
129- const pgm_func_t sampling_method_table [] = {
131+ static const pgm_func_t sampling_method_table [] = {
130132 [ALTERNATE ] = random_polyagamma_alternate ,
131133 [DEVROYE ] = random_polyagamma_devroye ,
132134 [SADDLE ] = random_polyagamma_saddle ,
@@ -135,7 +137,7 @@ const pgm_func_t sampling_method_table[] = {
135137};
136138
137139
138- PGM_INLINE double
140+ double
139141pgm_random_polyagamma (bitgen_t * bitgen_state , double h , double z , sampler_t method )
140142{
141143 double out ;
@@ -145,15 +147,15 @@ pgm_random_polyagamma(bitgen_t* bitgen_state, double h, double z, sampler_t meth
145147}
146148
147149
148- PGM_INLINE void
150+ void
149151pgm_random_polyagamma_fill (bitgen_t * bitgen_state , double h , double z ,
150152 sampler_t method , size_t n , double * out )
151153{
152154 sampling_method_table [method ](bitgen_state , h , z , n , out );
153155}
154156
155157
156- PGM_INLINE void
158+ void
157159pgm_random_polyagamma_fill2 (bitgen_t * bitgen_state , const double * h , const double * z ,
158160 sampler_t method , size_t n , double * restrict out )
159161{
0 commit comments