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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:39:06+00:00 2026-05-23T09:39:06+00:00

Im getting a slight math error in my program, which is causing problems in

  • 0

Im getting a slight math error in my program, which is causing problems in the rest of it, and i dont get why it is happening. in this part of the class, i did not overload the operators for built in types (i hope). if i did, please show me where

this function is meant to calculate the least number of bits needed to store a the number, which is stored in a deque <uint8_t> value as one value, so 0x123456 will be stored as {0x12, 0x34, 0x56}, and the output to integer.bits() should be 21

    // all types here are standard, so i dont know whats going on
    unsigned int bits(){
        unsigned int out = value.size() << 3;
        std::cout << out << " " << value.size() << " " << (value.size() << 3) << std::endl;
        uint8_t top = 128;
        while (!(value.front() & top)){
            out--;
            top >>= 1;
        }
        return out;
    }

yet, this part is couting

8 1 8
16 2 16
...

and finally, 
18 3 18

http://ideone.com/zLfz2

  • 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-23T09:39:07+00:00Added an answer on May 23, 2026 at 9:39 am

    3*8 is 24, and in hex that’s 0x18. You have std::hex scattered about your code…

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

Sidebar

Related Questions

Anyone getting this error when using the new free chart controls MS bought from
Getting super frustrated trying to get this working. Basically this is for a site
I getting the following error when I try to connect to my server app
I'm getting a slight distortion (sounds like buzzing) in the background when I run
I have a slight problem with getting the options within the select tag. Some
This might be extremely trivial, and if so I apologise, but I'm getting really
I have a slight issue with getting Auto Complete to search when the text
Getting a NSString as follows: NSString *lastSyncDate = [[items objectAtIndex:0] objectForKey:@LastSyncDate]; This value is:
I'm getting an error here that says I haven't defined a method, but it
Getting the subdomain from a URL sounds easy at first. http://www.domain.example Scan for the

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.