BoolExtensions.ToBitwiseMask32(Boolean) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
public static int ToBitwiseMask32 (this bool flag);
static member ToBitwiseMask32 : bool -> int
<Extension()>
Public Function ToBitwiseMask32 (flag As Boolean) As Integer
Parameters
- flag
- Boolean
The input value to convert.
Returns
0xFFFFFFFF if flag
is true
, 0x00000000 otherwise.
Remarks
This method does not contain branching instructions, and it is only guaranteed to work with Boolean values being either 0 or 1. Operations producing a Boolean result, such as numerical comparisons, always result in a valid value. If the Boolean value is produced by fields with a custom FieldOffsetAttribute, or by using As<T>(Object) or other unsafe APIs to directly manipulate the underlying data though, it is responsibility of the caller to ensure the validity of the provided value.