Apply the new VCL_INTEGER limits

parent 39a84e09
...@@ -725,8 +725,8 @@ levels that are described for the ``random()`` function above, except ...@@ -725,8 +725,8 @@ levels that are described for the ``random()`` function above, except
that the ``VERY_STRONG`` level is not available. that the ``VERY_STRONG`` level is not available.
If ``bound`` is less than or equal to 0, then the return value lies If ``bound`` is less than or equal to 0, then the return value lies
within the entire possible range for an INT (positive or negative). within the entire possible range for an VCL_INT (-999999999999999
The default value of ``bound`` is 0. .. 999999999999999). The default value of ``bound`` is 0.
If ``bound`` is greater than 0, then the return value lies between 0 If ``bound`` is greater than 0, then the return value lies between 0
(inclusive) and ``bound`` (exclusive). To get a random integer between (inclusive) and ``bound`` (exclusive). To get a random integer between
......
...@@ -765,10 +765,9 @@ vmod_random_int(VRT_CTX, VCL_ENUM qualitys, VCL_INT bound) ...@@ -765,10 +765,9 @@ vmod_random_int(VRT_CTX, VCL_ENUM qualitys, VCL_INT bound)
AN(qualitys); AN(qualitys);
assert(qualitys[0] != 'V'); assert(qualitys[0] != 'V');
if (bound <= 0) { if (bound <= 0)
get_rnd(qualitys, &r, sizeof(VCL_INT)); return (vmod_random_int(ctx, qualitys,
return r; VRT_INTEGER_MAX - VRT_INTEGER_MIN) + VRT_INTEGER_MIN);
}
for (r = bound; r > 0; r >>= 8) for (r = bound; r > 0; r >>= 8)
nbytes++; nbytes++;
......
...@@ -638,8 +638,8 @@ levels that are described for the ``random()`` function above, except ...@@ -638,8 +638,8 @@ levels that are described for the ``random()`` function above, except
that the ``VERY_STRONG`` level is not available. that the ``VERY_STRONG`` level is not available.
If ``bound`` is less than or equal to 0, then the return value lies If ``bound`` is less than or equal to 0, then the return value lies
within the entire possible range for an INT (positive or negative). within the entire possible range for an VCL_INT (-999999999999999
The default value of ``bound`` is 0. .. 999999999999999). The default value of ``bound`` is 0.
If ``bound`` is greater than 0, then the return value lies between 0 If ``bound`` is greater than 0, then the return value lies between 0
(inclusive) and ``bound`` (exclusive). To get a random integer between (inclusive) and ``bound`` (exclusive). To get a random integer between
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment