What is the best way to set a particular bit in a variable in C -


one variable unsigned int a; View in C

Now say I want to set any i'th bit in '1' in this variable.

Note that there is some value in the variable. Then a = (1 < will not work

a = a + (1 Will work, but I'm exploring the fastest way. anything ??

bitword or a | = (1

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

javascript - What is an alternative to using getElementByClass for hiding multiple elements? -

c# - How to store a 128 bit integer with nHibernate? -