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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:16:29+00:00 2026-06-08T01:16:29+00:00

Say I have only two flags (bCold and bHot) that are getting set. I’ve

  • 0

Say I have only two flags (bCold and bHot) that are getting set. I’ve discovered what all possible combinations should equal. How then can I determine what the original (or compatible) constants would be from the below?

When bCold and bHot are both turned ON = 0x4100
When bCold and bHot are both turned OFF = 0x8200

If bCold is ON and bHOT is OFF =  0x8100
If bCold is OFF and bHOT is ON =  0x4200

Knowing the above, what should I set bCold and bHot to equal?

#define bCold  ((ULONG)0x???)
#define bHot   ((ULONG)0x???)

// Turn them on sometime later
long lCONFIG_FLAGS = bCold | bHOT; 
  • 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-08T01:16:30+00:00Added an answer on June 8, 2026 at 1:16 am

    Let’s say that 0bXXXXXXXY means binary where Y is the less significant bit.


    Assuming the result is set with bitwise operations:

    Your numbers are made of two bytes. The right (less significant) byte is always 0b00000000, since all numbers end with 00. Lets look at the left (more significant) byte:

    When bCold and bHot are both turned ON = 0x4100 = 0b01000001

    When bCold and bHot are both turned OFF = 0x8200 = 0b10000010

    If bCold is ON and bHOT is OFF = 0x8100 = 0b10000001

    If bCold is OFF and bHOT is ON = 0x4200 = 0b01000010

    From this you can see that the two left-most bits set the bHot, and the two rightmost bits set the bCold (right = less significant).

    So:
    
    0b01000000 = *bHot* ON -= `0x40`
    
    0b00000001 = *bCold*  ON  = `0x01`
    
    0b10000000 = *bHot* OFF = `0x80`
    
    0b00000010 = *bCold*  OFF = `0x02`
    

    Now, add the right byte, which we said is always zero, and you get

    *bHot* ON = 0x4000, OFF = 0x8000
    *bCold*  ON = 0x0100, OFF = 0x0200
    

    The result is set by bitwise "OR"


    Assuming the result is set by simply adding numbers:

    (which is wrong, because your post name include the bitwise OR mention, but still let’s try it just for fun)
    A simple equation will show us these figures:

    *bCold* OFF: 0x0200, ON:  0x0100
    *bHot*  OFF: 0x8000, ON:  0x4000
    

    The result could be set by simply adding the numbers, e.g. 0x0200 + 0x8000 = 0x8200 for both OFF.


    Conclusion

    As you can see, so the final result is:

    *bCold* OFF: 0x0200, ON: 0x0100
    
    *bHot*  OFF: 0x8000, ON: 0x4000
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have a simple table that only contains two columns: MailingListUser -
lets say i have two pages links.html & contents.php ... first page contains only
Lets say that I have only DHT (distributed hash table) implemented (in Python), and
Let's say you have a profile page that can only be accessed by the
Let's say I have a Type II SCD database, that is basically append only.
I have an object, that has many properties but the only two to worry
Say I have a web service where I want to serve the content only
Say I have an enum, public enum Colours { Red, Blue } The only
So let's say I have a matrix, mdat and I only know the index
If I have an object say @user and I want to render only certain

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.