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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:30:40+00:00 2026-05-24T09:30:40+00:00

I am wondering how to do converts between unsigned base 16 numbers and signed

  • 0

I am wondering how to do converts between unsigned base 16 numbers and signed base 10 numbers?

For example

5d0cfa30041d4348 <-> 6705009029382226760

024025978b5e50d2 <-> 162170919393841362

fb115bd6d34a8e9f <-> -355401917359550817

By the way, they are actually IDs of some items. And internally they are all 64-bit numbers, but in two presentations.

Any classes I can use of ?

Thanks

  • 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-24T09:30:41+00:00Added an answer on May 24, 2026 at 9:30 am

    If the base 16 value is a constant or stored in a variable a simple cast will work.

    long long llint1 = (long long int)0x5d0cfa30041d4348;
    long long llint2 = (long long int)0x024025978b5e50d2;
    long long llint3 = (long long int)0xfb115bd6d34a8e9f;
    
    NSLog(@"\n%lld\n%lld\n%lld", llint1, llint2, llint3);
    

    If the value is a string it will just need to be scanned first.

    unsigned long long tmp;
    NSScanner *nscanner = [NSScanner scannerWithString:@"0x5d0cfa30041d4348"];
    [nscanner scanHexLongLong:&tmp];
    
    llint1 = (long long int)tmp;
    
    nscanner = [NSScanner scannerWithString:@"0x024025978b5e50d2"];
    [nscanner scanHexLongLong:&tmp];
    
    llint2 = (long long int)tmp;
    
    nscanner = [NSScanner scannerWithString:@"0xfb115bd6d34a8e9f"];
    [nscanner scanHexLongLong:&tmp];
    
    llint3 = (long long int)tmp;
    
    NSLog(@"\n%lld\n%lld\n%lld", llint1, llint2, llint3);
    

    Note: the scanHexLongLong and other scan methods return a BOOL for whether or not the scan was successful. If working with strings it would be best to check that the scan succeeded.

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

Sidebar

Related Questions

I am wondering if there is a simple snippet which converts links of any
I am wondering if anyone has any experience using a JQuery plugin that converts
I was wondering if there was an easy way in SQL to convert an
I was wondering what is the best way to convert excel sheet column names
I was wondering what the easiest way is to convert an integer to the
I was wondering what the simplest way is to convert a string representation of
I'm just wondering if there's a better way of doing this in SQL Server
I am wondering if Mercurial by default converts $Id$ to the equivalent of Subversion
HI guys, I was wondering if there is any microsoft class which converts a
I was wondering if there was a way to directly convert the integer DayOfWeek

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.