[php-src] Issue #19343: MSVC Compiler warning (level 2) C4146 in php_random_uint128.h
| From: | KaseyJenkins | Date: | Fri, 01 Aug 2025 07:56:50 +0000 |
| Subject: | [php-src] Issue #19343: MSVC Compiler warning (level 2) C4146 in php_random_uint128.h | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250546@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/19343
Author: KaseyJenkins
### Description
The following
[code](https://github.com/php/php-src/blob/master/ext/random/php_random_uint128.h#L124) in
php_random_uint128.h gives out MSVC's
[C4146](https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4146?view=msvc-170)
warning (unary minus operator applied to unsigned type, result still unsigned):
```c
static inline uint64_t php_random_pcgoneseq128xslrr64_rotr64(php_random_uint128_t num)
{
const uint64_t
v = ((uint64_t) (num >> 64U)) ^ (uint64_t) num,
s = num >> 122U;
return (v >> s) | (v << ((-s) & 63));
}
```
PR to resolve it - [19342](https://github.com/php/php-src/pull/19342).
### PHP Version
```plain
PHP 8.5.0alpha4 (cli) (built: Aug 1 2025 08:40:27) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.5.0-dev, Copyright (c) Zend Technologies
with Zend OPcache v8.5.0alpha4, Copyright (c), by Zend Technologies
```
### Operating System
_No response_