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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:22:37+00:00 2026-05-20T11:22:37+00:00

I have a string: the quic Which is passed on to a function where

  • 0

I have a string:

“the quic”

Which is passed on to a function where the bits that make up the string are stored in an unsigned __int64. Resulting in the following output:

0111010001101000011001010010000001110001011101010110100101100011

However when I pass a string containing these values:

0xDE, 0x10, 0x9C, 0x58, 0xE8, 0xA4,
0xA6, 0x30, ‘\0’

The output isn’t as correct as I expected:

1111111111111111111111111111111111111111111111111010011000110000

I’m using the same code as in the first string, which reads:

(((unsigned __int64)Message[0]) << 56) | (((unsigned __int64)Message[1]) << 48) |
(((unsigned __int64)Message[2]) << 40) | (((unsigned __int64)Message[3]) << 32) |
(((unsigned __int64)Message[4]) << 24) | (((unsigned __int64)Message[5]) << 16) |
(((unsigned __int64)Message[6]) << 8) | (((unsigned __int64)Message[7]));

  • 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-20T11:22:38+00:00Added an answer on May 20, 2026 at 11:22 am

    I guess you did something like this,

    char a[] = {0xDE, 0x10, 0x9C, 0x58, 0xE8, 0xA4, 0xA6, 0x30};
    

    change it to unsigned char will solve your problem,

    unsigned char a[] = {0xDE, 0x10, 0x9C, 0x58, 0xE8, 0xA4, 0xA6, 0x30};
    

    I’ve tried both, the char version will be wrong in VC++, but unsigned version will be correct.

    If you want to know the reason, look at a simpler version,

    char a = 0xDE;
    unsigned char b = 0xDE;
    

    What’s the difference? 0xDE is an int type. For the first one, you are converting int to signed char, for the second one, you are converting int to unsigned char.

    From standard 4.7/2, 4.7/3

    If the destination type is signed, the
    value is unchanged if it can be
    represented in the destination type
    (and bit-field width); otherwise, the
    value is implementation-defined.

    If the destination type is unsigned,
    the resulting value is the least
    unsigned integer congruent to the
    source integer (modulo 2n where n is
    the number of bits used to represent
    the unsigned type). [ Note: In a two’s
    complement representation, this
    conversion is conceptual and there is
    no change in the bit pattern (if there
    is no truncation). —end note ]

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

Sidebar

Related Questions

i have string stored in python variables, and i am outputting a html that
I have string which is of format: ;1=2011-10-23T16:16:53+0530;2=2011-10-23T16:16:53+0530;3=2011-10-23T16:16:53+0530;4=2011-10-23T16:16:53+0530; I have written following code to
i have string that i need to make custom parser but i am stuck
I have string that look like Array that fetched from other webservice like this
I have string that displays UTF-8 encoded characters, and I want to convert it
I have string. I then split the string to make an array. I use
I have string in which it has Date of type- 'mm-dd-yyyy'; I have to
I have string separated by dot ('.') characters that represents a hierarchy: string source
I have string variable which represents the full path of some file, like: x
I have string which should be split on . (point) and (space). I have

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.