Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6183355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:21:03+00:00 2026-05-24T01:21:03+00:00

On a 64-bit machine (1 ^ 2489596804) gives -1805370491 in response. However, when I

  • 0

On a 64-bit machine

(1 ^ 2489596804)

gives -1805370491 in response. However, when I do this on a 32-bit PHP machine, I get 2489596805 in response.

So, I tried to get it working on the 32-bit machine using gmp_strval(gmp_xor(1,2489596804)), but it also yields 2489596805. So what’s up, and how can I get the right response?

Update: I just noticed that the 64-bit result is what you get from subtracting the 32-bit max from it (4294967295).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T01:21:04+00:00Added an answer on May 24, 2026 at 1:21 am

    It’s the same result, simply interpreted differently:

    0x94643B85 =  2489596805 (unsigned 32-bit integer)
    0x94643B85 = -1805370491 (signed 32-bit integer)
    

    The reason you see a negative value on your 64-bit machine is that you’re interpreting that result as a signed 32-bit integer.

    If you really want to convert between the two interpretations, I think you’ll have to do this yourself. A simple way to do that would be something like this:

    <?php
    function toSigned($value) {
      if ($value <= 2147483647)
        return $value;
      return $value - 4294967295 + 1;
    }
    
    function toUnsigned($value) {
      if ($value >= 0)
        return $value;
      return $value + 4294967295 - 1;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using ubuntu 12.04 on 64 bit machine, I have this simple C
i downloaded Mysql server for win64-bit machine from http://dev.mysql.com/downloads/mirror.php?id=409022 this link. Then i installed
I am running this on a Windows 7 (64 bit) machine. I installed RoR
Assume my system as 32 bit machine. Considering this if I use long int
Possible Duplicate: How to detect Windows 64 bit platform with .net? I'm using this
On my 64-bit machine, this C# code works: new byte[2L * 1024 * 1024
I have installed the Oracle Client for the 64 bit machine using the XCopy
I am building chromium source code on windows7 32 bit machine. I am using
I'm wondering if I can still develop 32-bit apps using a 64-bit machine (64-bit
The below mentioned code; worked well on 32 bit machine but its not working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.