Sign in Join
Wiki copytemporary

Not/ru: what changed

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

Title: Not/ru

OldNewLine
1+\
2+\
3+
4+## Логическая операция
5+
6+Логическая операция **Not** выдает значение [[True/ru|true]] если значение равно [[False/ru|false]].
7+
8+### Таблица истинности
9+
10+| A | Not A |
11+|-----------|-----------|
12+|   false   |   true |
13+|   true   |   false   |
14+
15+## Побитовая операция
16+
17+Побитовая операция **not** устанавливает бит в 1 если соответствующий бит операнда равен 0, и в 0 если бит равен 1.
18+
19+### Единичное дополнение
20+
21+``` pascal
22+ function OnesComplement ( const aValue : byte ): byte;
23+ begin
24+ result := Not AValue;
25+ end;
26+```
27+
28+Если вы вызовете OnesComplement([[Percent sign/ru|%]]10000000), то получите %01111111 (%10000000 = 128 и %01111111 = 127). Если вы вызовете OnesComplement(%00000111), то результатом будет 248 (248 = %11111000).
29+
30+``` pascal
31+ function OnesComplement2 ( const aValue : shortint ): shortint;
32+ begin
33+ result := Not AValue;
34+ end;
35+```
36+
37+Если вы вызовете OnesComplement2(%00000010), то получится %11111101 (%00000010 = 2 и %11111101 = -3, когда [[Type/ru|тип]] операнда shortint). Если вы вызовете OnesComplement2(7), то получите -8 (-8 = %11111000, когда тип операнда shortint и 7 = %00000111 ).
38+
39+## См. также
40+
41+- [[And/ru|And]]
42+- [[Shl/ru|Shl]]
43+- [[Const/ru|Const]]
44+- [[Function/ru|Function]]
45+- [[Byte/ru|Byte]]
46+- [[Shortint/ru|Shortint]]
47+- [[Shl|Clear_a_bit]] (bitwise example)
48+- [[Bit manipulation/ru|Bit manipulation]]
49+
50+---
51+*From the Free Pascal wiki, page "Not/ru", 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