Agh, what's wrong with this function?
Can anyone spot anything glaringly wrong with this function? It's supposed to change one of the bit flags in a int with a pass-by referance. If it matters, the int in question is a dynamically allocated pointer within a class.
For some reason it isn't changing the target. I could go nuts here. If this isn't enough info I could post the whole program, but I don't THINK that should be necessary.
Code:
void body::flagset( int &target, const int bit, const char*op_type )
{
if (op_type == "lower")
target = target & (int)(!(pow(2, bit - 1)));
else if (op_type == "raise")
target = target | (int)(pow(2, bit - 1));
}
:confused: :confused: