[Back to NUMBERS SWAG index] [Back to Main SWAG index] [Original]
Unit BitOper;
{$F+,O+}
Interface
Function GetBit(a,n: byte):byte;              { �®§¢à�é�¥â §��ç¥�¨¥ n-®£® ¡¨â�
}
Function SetBitZero(a,n:byte):byte;                      { �¡à�áë¢�¥â n-ë© ¡¨â
}
Function SetBitOne(a,n:byte):byte;                    { �áâ���¢«¨¢�¥â n-ë© ¡¨â
}
Implementation
Function GetBit(a,n: byte):byte;              { �®§¢à�é�¥â §��ç¥�¨¥ n-®£® ¡¨â�
}
Begin
    GetBit:=1 and (a shr n);
End;
Function SetBitZero(a,n:byte):byte;                      { �¡à�áë¢�¥â n-ë© ¡¨â
}
Begin
    SetBitZero:=a and (not(1 shl n));
End;
Function SetBitOne(a,n:byte):byte;                    { �áâ���¢«¨¢�¥â n-ë© ¡¨â
}
Begin
    SetBitOne:=a or (1 shl n);
End;
End.
[Back to NUMBERS SWAG index] [Back to Main SWAG index] [Original]