Home > Software engineering >  O master explained in detail... thank you
O master explained in detail... thank you

Time:10-14

 Function LFuncGetBitStatus (Value, Bit) 
LFuncGetBitStatus=Value And 2 ^ (Bit)=2 ^ Bit
End the Function

CodePudding user response:

Drawn from a number of a particular binary values,
For example,
Value=https://bbs.csdn.net/topics/47
Bit=3
The Value of the binary form is 101111
2 ^ 3 is 3 to the power of 2, 8, 1000
The Value And 2 ^ Bit is 101111 And 1000
101111
And 001000
-- -- -- -- -- -- -- -- -- --
001000
The result is 1000, and 2 ^ 3 equal,
Returns True
So the fourth in the binary format of 47 (from low number) is True

CodePudding user response:

The
refer to the original poster xuedongli response:
 Function LFuncGetBitStatus (Value, Bit) 
LFuncGetBitStatus=Value And 2 ^ (Bit)=2 ^ Bit
End the Function


First the function should return value type, such as: the function SSS (... ) as long
Which means that the function returns a long integer
Secondly, from the point of view you function within the statement, LFuncGetBitStatus return should be a Boolean type, i.e., the true and false

CodePudding user response:

Check if a number of a binary 1, function declarations and best As a Boolean, it is a good programming habits,
  • Related