Difference between revisions of "Not/fr"
From Lazarus wiki
Jump to navigationJump to search (Created page with "{{not}} <br> <br> __TOC__ == Opération booléenne == '''Not''' produit une valeur true si la valeur de l'opérande est false et inversement. === Ta...") |
m (Fixed syntax highlighting; removed categories included in template) |
||
(One intermediate revision by one other user not shown) | |||
Line 27: | Line 27: | ||
=== Complément à 1 === | === Complément à 1 === | ||
− | <syntaxhighlight> | + | <syntaxhighlight lang=pascal> |
function OnesComplement ( const aValue : byte ): byte; | function OnesComplement ( const aValue : byte ): byte; | ||
begin | begin | ||
Line 33: | Line 33: | ||
end; | end; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | Si vous appelez OnesComplement([[Percent sign|%]]10000000), vous obtenez alors %01111111 (%10000000 = 128 et %01111111 = 127). Si vous appelez OnesComplement(%00000111), vous obtenez 248 (248 = %11111000). | + | Si vous appelez OnesComplement([[Percent sign/fr|%]]10000000), vous obtenez alors %01111111 (%10000000 = 128 et %01111111 = 127). Si vous appelez OnesComplement(%00000111), vous obtenez 248 (248 = %11111000). |
− | <syntaxhighlight> | + | <syntaxhighlight lang=pascal> |
function OnesComplement2 ( const aValue : shortint ): shortint; | function OnesComplement2 ( const aValue : shortint ): shortint; | ||
begin | begin | ||
Line 55: | Line 55: | ||
* [[Shl/fr|#Clear_a_bit| Clear_a_bit]] (exemple d'opération bit à bit) | * [[Shl/fr|#Clear_a_bit| Clear_a_bit]] (exemple d'opération bit à bit) | ||
* [[Bit manipulation/fr|Bit manipulation]] | * [[Bit manipulation/fr|Bit manipulation]] | ||
− | |||
− |
Latest revision as of 10:20, 21 February 2020
│
Deutsch (de) │
English (en) │
suomi (fi) │
français (fr) │
русский (ru) │
Opération booléenne
Not produit une valeur true si la valeur de l'opérande est false et inversement.
Table de vérité
A | Not A |
---|---|
false | true |
true | false |
Opération bit à bit
not bit à bit inverse les bits (1 devient 0, 0 devient 1).
Complément à 1
function OnesComplement ( const aValue : byte ): byte;
begin
result := Not AValue;
end;
Si vous appelez OnesComplement(%10000000), vous obtenez alors %01111111 (%10000000 = 128 et %01111111 = 127). Si vous appelez OnesComplement(%00000111), vous obtenez 248 (248 = %11111000).
function OnesComplement2 ( const aValue : shortint ): shortint;
begin
result := Not AValue;
end;
If you call OnesComplement2(%00000010) then get %11111101 (%00000010 = 2 and %11111101 = -3 when type is shortint). If you call OnesComplement2(7) then get -8 (-8 = %11111000 when type is shortint and 7 = %00000111 ).
See also
- And
- Or
- Shl
- Const
- Function
- Byte
- Shortint
- #Clear_a_bit| Clear_a_bit (exemple d'opération bit à bit)
- Bit manipulation