Product Information > JADE Encyclopaedia of Primitive Types > Chapter 1 - Primitive Types > bitAnd

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 (10, 8, 7, 2016, or 2008) 
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 10, Windows 8, Windows 7, Windows // Server 2016, Windows Server 2012, or Windows Server 2008
return 'Windows ' & version; endif; if platform = Node.OSWindowsMobile then // version is Windows CE return 'Windows CE ' & version; endif; endif; return '* Unknown platform: ' & platform.String & ' version: ' & version; end;