bitAnd

bitAnd(op: Integer): Integer;

The bitAnd method of the Integer primitive type compares each bit in the receiver with the corresponding bit in the op parameter, and returns an integer representing the receiver bits ANDed with the argument.

The generated return values are listed in the following table.

Bits in Receiver and Operand Corresponding Bit in Return Value
Both bits are 1 1
One or both bits are not 1 0

The following example shows the use of the bitAnd method.

vars
    platform     : Integer;
    version      : String;
    architecture : Integer;
begin
    platform := node.getOSPlatform(version, architecture);
    if platform.bitAnd(Node.OSWindows) <> 0 then
        // operating system is Windows family 
        if platform = Node.OSWindowsHome then
            // version is an older version of Windows (unsupported)
            return 'Windows (unsupported) ' & version;
        endif;
        if platform = Node.OSWindowsEnterprise then
            // version is Windows 11, Windows 10, Windows Server 2022, 
            // Windows Server 2019, Windows Server 2016, or Windows Server 2012
            return 'Windows ' & version;
        endif;
        if platform = Node.OSWindowsMobile then
            // version is Windows CE
            return 'Windows CE (unsupported) ' & version;
        endif;
    endif;
    return '* Unknown platform: ' & platform.String & ' version: ' &
           version;
end;