added qse_randxs32() and qse_randxs64().

changed awk's rand() to use these.
fixed a bug of registering rand() with a wrong number of arguments in StdAwk.
This commit is contained in:
2012-08-27 15:10:57 +00:00
parent 53c98cce93
commit a35c10fbfc
4 changed files with 114 additions and 36 deletions

View File

@ -844,16 +844,19 @@ static int val_int_to_str (
qse_awk_rtx_valtostr_out_t* out)
{
qse_char_t* tmp;
qse_long_t t;
qse_ulong_t t;
qse_size_t rlen = 0;
int type = out->type & ~QSE_AWK_RTX_VALTOSTR_PRINT;
t = v->val;
if (t == 0) rlen++;
if (v->val == 0) rlen++;
else
{
/* non-zero values */
if (t < 0) { t = -t; rlen++; }
if (v->val < 0)
{
t = v->val * -1; rlen++;
}
else t = v->val;
while (t > 0) { rlen++; t /= 10; }
}
@ -939,11 +942,10 @@ static int val_int_to_str (
}
}
t = v->val;
if (t == 0) tmp[0] = QSE_T('0');
if (v->val == 0) tmp[0] = QSE_T('0');
else
{
if (t < 0) t = -t;
t = (v->val < 0)? (v->val * -1): v->val;
/* fill in the buffer with digits */
while (t > 0)