fixed a bug in qse_gettime().

fixed wrong declaraations in alg.h
This commit is contained in:
hyung-hwan 2012-08-27 15:53:53 +00:00
parent a35c10fbfc
commit 8367a4cd12
3 changed files with 49 additions and 2 deletions

View File

@ -201,7 +201,8 @@ protected:
flt_t sqrt (flt_t x); flt_t sqrt (flt_t x);
protected: protected:
unsigned int seed; qse_long_t seed;
qse_ulong_t prand;
qse_htb_t cmgrtab; qse_htb_t cmgrtab;
bool cmgrtab_inited; bool cmgrtab_inited;

View File

@ -49,6 +49,10 @@ typedef int (*qse_search_comper_t) (
*/ */
typedef qse_search_comper_t qse_sort_comper_t; typedef qse_search_comper_t qse_sort_comper_t;
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* The qse_bsearch() function performs binary search over a sorted array. * The qse_bsearch() function performs binary search over a sorted array.
* It looks for an item matching @a key in an array @a base containing * It looks for an item matching @a key in an array @a base containing
@ -128,4 +132,46 @@ qse_uint32_t qse_rand31 (
qse_uint32_t seed qse_uint32_t seed
); );
#if (QSE_SIZEOF_UINT32_T > 0)
/**
* The qse_randxs32() function implements the xorshift random number generator
* by George Marsaglia.
*/
qse_uint32_t qse_randxs32 (
qse_uint32_t seed
);
#endif
#if (QSE_SIZEOF_UINT64_T > 0)
/**
* The qse_randxs64() function implements the xorshift random number generator
* by George Marsaglia.
*/
qse_uint64_t qse_randxs64 (
qse_uint64_t seed
);
#endif
#if (QSE_SIZEOF_ULONG_T == QSE_SIZEOF_UINT64_T)
# define qse_randxsulong(seed) qse_randxs64(seed)
#elif (QSE_SIZEOF_ULONG_T == QSE_SIZEOF_UINT32_T)
# define qse_randxsulong(seed) qse_randxs32(seed)
#else
# error Unsupported
#endif
#if (QSE_SIZEOF_UINT_T == QSE_SIZEOF_UINT64_T)
# define qse_randxsuint(seed) qse_randxs64(seed)
#elif (QSE_SIZEOF_UINT_T == QSE_SIZEOF_UINT32_T)
# define qse_randxsuint(seed) qse_randxs32(seed)
#else
# error Unsupported
#endif
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -476,7 +476,7 @@ int qse_timelocal (const qse_btime_t* bt, qse_ntime_t* nt)
return 0; return 0;
#else #else
*nt = ((qse_ntime_t)mktime(&tm)*QSE_MSECS_PER_SEC) + bt->msec; *nt = ((qse_ntime_t)mktime(&tm)*QSE_MSECS_PER_SEC) + bt->msec;
return -1; return 0;
#endif #endif
} }