zend_ulong result;
result = php_mt_rand();
+#if ZEND_ULONG_MAX > UINT32_MAX
if (umax > UINT32_MAX) {
result = (result << 32) | php_mt_rand();
}
+#endif
/* Special case where no modulus is required */
if (UNEXPECTED(umax == ZEND_ULONG_MAX)) {
/* Discard numbers over the limit to avoid modulo bias */
while (UNEXPECTED(result > limit)) {
#if ZEND_ULONG_MAX > UINT32_MAX
- result = (result << 32) | php_mt_rand();
+ if (umax > UINT32_MAX) {
+ result = (result << 32) | php_mt_rand();
+ }
+ else {
+ result = php_mt_rand();
+ }
#else
result = php_mt_rand();
#endif