Sign in Join
Wiki copytemporary

Not/fr: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
1-\
2-\
3-
41## Opération booléenne
52
63**Not** produit une valeur [[True/fr|true]] si la valeur de l'opérande est [[False/fr|false]] et inversement.
74
85### Table de vérité
96
107| A | Not A |
118|-----------|-----------|
129|   false   |   true |
1310|   true   |   false   |
1411
1512## Opération bit à bit
1613
1714**not** bit à bit inverse les bits (1 devient 0, 0 devient 1).
1815
1916### Complément à 1
2017
2118``` pascal
2219 function OnesComplement ( const aValue : byte ): byte;
2320 begin
2421 result := Not AValue;
2522 end;
2623```
2724
2825Si 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).
2926
3027``` pascal
3128 function OnesComplement2 ( const aValue : shortint ): shortint;
3229 begin
3330 result := Not AValue;
3431 end;
3532```
3633
3734If you call OnesComplement2(%00000010) then get %11111101 (%00000010 = 2 and %11111101 = -3 when [[Type|type]] is shortint). If you call OnesComplement2(7) then get -8 (-8 = %11111000 when type is shortint and 7 = %00000111 ).
3835
3936## See also
4037
4138- [[And/fr|And]]
4239- [[Or/fr|Or]]
4340- [[Shl/fr|Shl]]
4441- [[Const/fr|Const]]
4542- [[Function/fr|Function]]
4643- [[Byte/fr|Byte]]
4744- [[Shortint/fr|Shortint]]
4845- [[Shl/fr|#Clear_a_bit| Clear_a_bit]] (exemple d'opération bit à bit)
4946- [[Bit manipulation/fr|Bit manipulation]]
5047
5148---
5249*From the Free Pascal wiki, page "Not/fr", as it stood on 2020-02-21 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history