Sign in Join
Wiki copytemporary

Not/fr: what changed

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

Title: Not/fr

OldNewLine
1+\
2+\
3+
4+## Opération booléenne
5+
6+**Not** produit une valeur [[True/fr|true]] si la valeur de l'opérande est [[False/fr|false]] et inversement.
7+
8+### Table de vérité
9+
10+| A | Not A |
11+|-----------|-----------|
12+|   false   |   true |
13+|   true   |   false   |
14+
15+## Opération bit à bit
16+
17+**not** bit à bit inverse les bits (1 devient 0, 0 devient 1).
18+
19+### Complément à 1
20+
21+``` pascal
22+ function OnesComplement ( const aValue : byte ): byte;
23+ begin
24+ result := Not AValue;
25+ end;
26+```
27+
28+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).
29+
30+``` pascal
31+ function OnesComplement2 ( const aValue : shortint ): shortint;
32+ begin
33+ result := Not AValue;
34+ end;
35+```
36+
37+If 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 ).
38+
39+## See also
40+
41+- [[And/fr|And]]
42+- [[Or/fr|Or]]
43+- [[Shl/fr|Shl]]
44+- [[Const/fr|Const]]
45+- [[Function/fr|Function]]
46+- [[Byte/fr|Byte]]
47+- [[Shortint/fr|Shortint]]
48+- [[Shl/fr|#Clear_a_bit| Clear_a_bit]] (exemple d'opération bit à bit)
49+- [[Bit manipulation/fr|Bit manipulation]]
50+
51+---
52+*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