Xor/ru
Deutsch · English · Français · Suomi · Русский
Логическая операция
Исключающее или (xor) возвращает значение true тогда и только тогда, когда один из операндов имеет значение true.
Таблица истинности
| A | B | A xor B |
|---|---|---|
| false | false | false |
| false | true | true |
| true | false | true |
| true | true | false |
Побитовая операция
Побитовая операция xor устанавливает бит в значение 1 в тех местах, где отличаются соответствующие биты в операндах, и в 0, если биты одинаковые.
Переключение битов
function ToggleBit(const AValue,ABitNumber:integer):integer;
begin
result := AValue xor 1 shl ABitNumber;
end;Если вы вызовете ToggleBit(11,0), то результатом будет 10. Если вызовете ToggleBit(10,2), то результатом будет 14.
См. также
From the Free Pascal wiki, page "Xor/ru", as it stood on 2020-03-03 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.
Edited on wiki.freepascal.org by 2 people, 2018–2020
From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.
| When | Who | What changed |
|---|---|---|
| Useroflazarus | Created page | |
| Trev | Fixed syntax highlighting (minor) |
Talk about this page
Nobody has opened a bench for this page yet. Sign in to open one.
