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 8970351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:43:00+00:00 2026-06-15T17:43:00+00:00

Ok, this is a weird issue : I’m using unsigned long long variables (I’ve

  • 0

Ok, this is a weird issue :

  • I’m using unsigned long long variables (I’ve used even long ones, with the same effect)
  • I need to be able to store 64-bit integers (sizeof returns 8, which is fine)

However, when I’m trying to go to values like 1<<63, and perform some simple bitwise operations, I – oddly – seem to be getting negative values. Why’s that?

My test code :

    unsigned long long c = 0;

    c |= 1l << 56; printf("c = %lld\n",c);
    c |= 1l << 63; printf("c = %lld\n",c);

Output :

c = 72057594037927936 
c = -9151314442816847872

Sidenotes :

  1. Of course, same thing happens even if I do c = 1l<<63 directly.
  2. All tests made on Mac OS X 10.6, and compiled using Apple’s LLVM Compiler 3.0

Any suggestions?

  • 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-06-15T17:43:01+00:00Added an answer on June 15, 2026 at 5:43 pm

    The d part of the %lld specifier is telling printf that the argument should be treated as a signed integer. Use a u instead: %llu.

    From the man pages:

    d, i

    The int argument is converted to signed decimal notation.

    o, u, x, X

    The unsigned int argument is converted to unsigned octal (o), unsigned decimal (u), or unsigned hexadecimal (x and X) notation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this weird issue which i'm absolutely don't even know how to address...
I have this weird issue with special characters. In JSP, I am using field
This is a weird issue. I'm accessing my online database using premiumsofts Navicat for
Got this weird issue with Using jQuery 1.6.0 issue. I am trying to append
I have this weird issue in Magento when someone places an order using PayPal
I've got a weird issue. Basically, I need to do this: $handle = stream_context_create();
having this weird issue while inserting to MongoDB using PHP. My insertion code is
I'm getting this weird issue. Basically I'm animating a view with translate animation. (Translate
I am having this weird issue when I was trying to merge my projects
I'm trying to figure out this weird issue I've been having, and the root

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.