Not/ru
Deutsch · English · Français · Suomi · Русский
Логическая операция
Логическая операция Not выдает значение true если значение равно false.
Таблица истинности
| A | Not A |
|---|---|
| false | true |
| true | false |
Побитовая операция
Побитовая операция not устанавливает бит в 1 если соответствующий бит операнда равен 0, и в 0 если бит равен 1.
Единичное дополнение
function OnesComplement ( const aValue : byte ): byte;
begin
result := Not AValue;
end;Если вы вызовете OnesComplement(%10000000), то получите %01111111 (%10000000 = 128 и %01111111 = 127). Если вы вызовете OnesComplement(%00000111), то результатом будет 248 (248 = %11111000).
function OnesComplement2 ( const aValue : shortint ): shortint;
begin
result := Not AValue;
end;Если вы вызовете OnesComplement2(%00000010), то получится %11111101 (%00000010 = 2 и %11111101 = -3, когда тип операнда shortint). Если вы вызовете OnesComplement2(7), то получите -8 (-8 = %11111000, когда тип операнда shortint и 7 = %00000111 ).
См. также
- And
- Shl
- Const
- Function
- Byte
- Shortint
- Clear_a_bit (bitwise example)
- Bit manipulation
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.
Talk about this page
Nobody has opened a bench for this page yet. Sign in to open one.
