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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:59:05+00:00 2026-05-31T11:59:05+00:00

i need to implement some kind of bit to status mapping and i don’t

  • 0

i need to implement some kind of bit to status mapping and i don’t know how to implement this thing – maybe i have a blockhead 😉

Okay so i have a status-code which can be max. 32 bit long for example 1001 0011
Each bit belongs to a special status code – string.

For example:

Bit 1: String Cancel
Bit 2: String Okay
Bit 3: String Save
....
Bit 32: String Next

Now i have to determine which bits are set and return all status code – strings which are set int the 32 bit long status.

I like to prefer some kind of dictionary or sumthin like that where i can store for each bit the corresponding status code.

Then i like to loop thru the 32 bit long status code and get the corresponding status code string out of the dictionary – store it in a string and return it after the 32 bit long status code has been looped through.

Somebody has an idea for that?

  • 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-31T11:59:07+00:00Added an answer on May 31, 2026 at 11:59 am

    you can use enums with flags attribute. Enum can be cast from and to int.
    Each enum value can be set so your status can look like this

    [Flags]
    enum Status { None = 0 , Cancel = 1 , Ok = 2 , Save = 4 ... } 
    

    Flags attribute

    Indicates that an enumeration can be treated as a bit field; that is,
    a set of flags.

    you can test with

     if ((status & Status.Ok) == Status.Ok)
     {
     // Do something
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

SO buddies, greetings. I have some password requirements I need to implement and one
I need some advice for a design which I have to implement in application.
So, I need some way to implement an undirected network ( I think this
I need to implement some kind of RBAC for a WPF app that I'm
I need to implement some kind of metric space search in Postgres(*) (PL or
I need implement some kind of lazy loading in my UITableView. - (UITableViewCell *)tableView:(UITableView
I need to implement some new functions on an editor. I picked Emacs -
I need to implement some form of communication mechanism in my application, to send
I need to implement for current project some secure login in php. I wrote
I need to implement something. Something that could do some certain task in my

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.