2013-07-17 02:03 AM
HI ,
i have this function which sets x bit( passed as a parameter) of a byte . after some code the variable should be restored to it's initial value .char a ; global variable void function(char x){int b = a;a |= (1<<x); //set the x bit ...some other code ....a = b ;}So when i leave the function the value of a is restored to initial state . Is there any way i can optimize this (set reset procedure of a bit )?2013-07-17 07:43 AM
Decide to use int or char, then be consistent. I'd suggest that int being a native 32-bit representation would be more efficient.