Not/fi
Deutsch · English · Français · Suomi · Русский
Not boolean lausekkeessa
Not tuottaa arvon true jos alkuperäinen arvo on false. Usein not suomennetaan ei:ksi (Tai eriksi. Tuloshan on eri kuin alkuperäinen).
Totuustaulukko
| A | Not A |
|---|---|
| false | true |
| true | false |
Not bittikohtaisissa toiminnoissa
Bitettäin tehtävä not eli ei (eri) asettaa kyseisen bitin ykköseksi (1) jos vastaava bitti oli nolla (0). Jos se oli ykkönen (1) niin not asettaa sen nollaksi (0).
Yhden Komplementti
function OnesComplement ( const aValue : byte ): byte;
begin
result := Not AValue;
end;Jos kutsut funktiota OnesComplement(%10000000) niin saat %01111111 (Binäärinen %10000000 on desimaalijärjestelmässä 128 ja vastaavasti kaksijärjestelmän %01111111 on desimaalijärjestelmän 127). Jos kutsut funktiota OnesComplement(%00000111) niin saat 248 (248 = %11111000).
function OnesComplement2 ( const aValue : shortint ): shortint;
begin
result := Not AValue;
end;Jos kutsut OnesComplement2(%00000010) niin saat %11111101 (huomio että %00000010 = 2 ja %11111101 = -3 kun tyyppi on Shortint). Jos kutsut OnesComplement2(7) niin saat -8 (-8 = %11111000 kun tyyppi on shortint ja 7 = %00000111 ).
Katso myös
- And (ja)
- Or (tai)
- Shl
- Const
- Function
- Byte
- Shortint
- Nollaa bitti
- Bit manipulation
- Binäärinumerot
From the Free Pascal wiki, page "Not/fi", 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.
