Sign in Join
Wiki copytemporary

Xor/fr: what changed

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

Title: Xor/fr

OldNewLine
1+# Opération booléenne
2+
3+Le Ou exclusif (**xor**) vaut [[True/fr|true]] si et seulement une opérande exactement vaut true. Dit autrement, l'opérateur vaut true si les deux opérandes ont des valeurs de vérité différentes.
4+
5+## Table de vérité
6+
7+| A | B | A xor B |
8+|-----------|-----------|---------|
9+|   false   |   false   |   false |
10+|   false |   true |   true |
11+|   true |   false |   true |
12+|   true |   true |   false |
13+
14+# Opération bit à bit
15+
16+Le xot bit à bit met le bit à 1 si les bits opérandes correspondants sont différents, et vaut sinon.
17+
18+## Inverser un bit
19+
20+``` pascal
21+function ToggleBit(const AValue,ABitNumber:integer):integer;
22+begin
23+ result := AValue xor 1 shl ABitNumber;
24+end;
25+```
26+
27+Si vous appelez ToggleBit(11,0), vous obtenez 10. Si vous appelez ToggleBit(10,2) alors vous obtenez 14.
28+
29+## Voir aussi
30+
31+- [[Variable parameter/fr|XOR swap]]
32+- [[Shl/fr|Opérateur Shl]]
33+- [[Const/fr|Const]]
34+- [[Function/fr|Fonction]]
35+- [[Integer/fr|Type Integer]]
36+
37+---
38+*From the Free Pascal wiki, page "Xor/fr", 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](/wiki-contact).*

Back to history