Free Pascal <-> PHP | Negácia bit po bite

Free Pascal

not

Popis

not par1
Použitá kľúčové slová: not

Vstup


Výstup

Príklady

Free Pascal

Možné požitie Negácia bit po bite:
x := not(32 shr 2);       // x = -9
y := not x;              // y = 8
z := not(x and 5) and y;    // z = 8

Free Pascal

Navyše ešte jeden príklad na to v akých situáciách môžeme použiť operáciu Negácia bit po bite:
not i
not$abcd
not(i and 4)
.
PHP

~

Popis

~ par1
Použitá kľúčové slová: ~

Vstup


Výstup

Príklady

PHP

Možné požitie Negácia bit po bite:
$x = ~(32 >>2);       // x = -9
$y = ~$x;              // y = 8
$z = ~($x & 5) & $y;    // z = 8

PHP

Navyše ešte jeden príklad na to v akých situáciách môžeme použiť operáciu Negácia bit po bite:
~$i
~0xabcd
~($i & 4)

Môžete to nájsť v nasledujúcich kolekciách: bitové operátory
V iných jazykoch: en hu cz sk