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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:25:26+00:00 2026-05-15T10:25:26+00:00

#define OUTGOING_MASK 0x0c #define OUTGOING_DISABLED 0x04 #define OUTGOING_ENABLED 0x08 #define OUTGOING_AUTO 0x00 #define REFER_SUPPORTED

  • 0
#define OUTGOING_MASK         0x0c
#define OUTGOING_DISABLED     0x04
#define OUTGOING_ENABLED      0x08
#define OUTGOING_AUTO         0x00
#define REFER_SUPPORTED       0x80 

Assume support is some value of type int.
I have a getter function

int get()
{
if(OUTGOING_DISABLED == support & OUTGOING_MASK)
return 1;
else if(OUTGOING_ENABLED == support & OUTGOING_MASK)
return 2;
else if(OUTGOING_AUTO == support & OUTGOING_MASK)
return 3;
}

I need to write set function for this like

void set(int val)
{
if(val ==1)
//todo
else if(value == 2)
//todo
else if(value == 3)
//todo
}

How to write getter and setter functions for this?
I need to get/set the support variable here

REFER_SUPPORTED will always be set in support.

  • 1 1 Answer
  • 1 View
  • 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-15T10:25:27+00:00Added an answer on May 15, 2026 at 10:25 am

    I have a statement such as a1 = b & a2; How to know the value of b using bitwise operators?

    You can’t recover value of b, unless a has ALL bits set. “&” is irreversible.

    Explanation. & operation has following table:

    a   b   result
    1 & 1 = 1
    0 & 1 = 0
    1 & 0 = 0
    0 & 0 = 0
    

    which means, to recover b, you could try to use following table:

    a   result  b
    0   0       unknown - could be 1 or 0
    0   1       invalid/impossible - could not happen
    1   0       0
    1   1       1
    

    As you can see it isn’t possible to guess b in all cases.

    In expression a & b = c, if you know c and a, you can’t recover b, because for every zeroed bit of c, and if corresponding bit of a is also zero, there are two possible states of corresponding bits of b. You can reliably recover b only if every bit of a is set to 1.

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

Sidebar

Related Questions

define('VAR_1', 'Some info 01'); define('VAR_2', 'Some info 02'); define('VAR_3', 'Some info 03'); define('VAR_4', 'Some
#define boo(fmt, ...) SomethingToDo(fmt, __VA_ARGS__) void foo(PCSTR fmt, ...) { // some other codes
(define a 42) (set! 'a 10) (define a 42) (define (symbol) 'a) (set! (symbol)
(define (lcs lst1 lst2) (define (except-last-pair list) (if (pair? (cdr list)) (cons (car list)
#define MAX 100 struct bs{ int ab; int ac; }be; struct s{ be b;
#define HISTORY_SIZE 50 #define INPUT_SIZE 512 /*Max input size*/ char input[INPUT_SIZE]; /*Holding user input
#define __HAVE_ARCH_STRCPY What's the meaning of __HAVE_ARCH ? I'm not a native speaker and
I define a 'block' of text as all lines between start of file, newline
I define HttpClient in 2 different ways: 1. Plain vanilla: client = new DefaultHttpClient();
code: #define f(a,b) a##b #define g(a) #a #define h(a) g(a) main() { printf(%s\n,h(f(1,2))); //[case

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.