Skip to content

MSVC Compiler warning (level 2) C4146 in php_random_uint128.h #19343

Closed as duplicate

Description

@KaseyJenkins

Description

The following code in php_random_uint128.h gives out MSVC's C4146 warning (unary minus operator applied to unsigned type, result still unsigned):

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.

PHP Version

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

Activity

  1. TimWolla commented on Aug 1, 2025

    @TimWolla
    Member

    Duplicate of #15106

  2. iluuu1994 commented on Aug 5, 2025

    @iluuu1994
    Member

    @TimWolla Should this be closed then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions