dimanche 4 juin 2017

Check if flag has bit combined values [duplicate]

This question already has an answer here:

enum status
{
  b1 = 0,
  b2 = 1 << 1,
  b3 = 1 << 2
}

void findStatus(status flag)
{
  // how do i check if flag has bit combination?
}

EXP : I would expect

findStatus(b1)

Not EXP :

findStatus(b2 | b3)

I need to check if the parameter has bit combined value passed or not?

Aucun commentaire:

Enregistrer un commentaire