Help for this page

Select Code to Download


  1. or download this
    use constant BIT0 => 0;
    use constant BIT1 => 1;
    use constant BIT2 => 2;
    use constant BIT3 => 4;
    #...
    
  2. or download this
    my %bitNames = (
        BIT0 => 0,
    ...
        BIT4 => 8,
    #...
    );
    
  3. or download this
    my $flag=0; # or value from your api
    vec($flag, $bitNames{BIT0}, 1)=$newBit;
    # you can also use vec to retrieve the old bit values:
    print "Value at position BIT3 is:",vec($flag, $bitNames{BIT3},1),"\n";