Sign in Join
Wiki copytemporary

Or/fr: what changed

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

Title: Or/fr

OldNewLine
1+# Opération booléenne
2+
3+Le **ou**booléen produit une valeur [[True/fr|true]] si l'une au moins de ses opérandes est vraie. Il produit [[False/fr|false]] uniquement si les deux opérandes sont fausses.
4+
5+## Table de vérité
6+
7+| A | B | A or B |
8+|-----------|-----------|---------|
9+|   false   |   false   |   false |
10+|   false |   true |   true |
11+|   true |   false |   true |
12+|   true |   true |   true |
13+
14+# Opération bit à bit
15+
16+Le **Or** logique (aussi connu comme or bit à bit) demande des opérandes ordinales, met à 1 un bit de résultat si l'un des deux bits correspondants dans les opérandes vaut 1 et met à 0 si les deux bits sont à 0. Cela pour tous les bits des opérandes.
17+
18+## Mettre un bit à 1
19+
20+``` pascal
21+function SetBit(const AValue, ABitNumber:integer):integer;
22+begin
23+ result := AValue or (1 shl ABitNumber);
24+end;
25+```
26+
27+Si vous appelez SetBit(%1000,1), vous obtenez alors %1010 (%1000 = 8 et %1010 = 10). Si vous appelez SetBit(10,2), vous obtenez 14 (14 = %1110). Si vous appelez SetBit(10,1), vous obtenez 10.
28+
29+## Voir aussi
30+
31+- [[And/fr|And]]
32+- [[Const/fr|Const]]
33+- [[Function/fr|Fonction]]
34+- [[Integer/fr|Integer]]
35+- [[Shl/fr|Shl]]
36+- [[Shr/fr|Shr]]
37+
38+---
39+*From the Free Pascal wiki, page "Or/fr", as it stood on 2020-02-23 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