Sign in Join
Wiki copytemporary

And/fi: what changed

Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
1-## Contents
2-
3- * 1 And (ja) boolean lausekkeessa
4- * 1.1 And eli ja-operaation totuustaulukko
5- * 2 And eli ja bittikohtaisissa toiminnoissa
6- * 2.1 Onko kakkosen potenssi
7- * 2.1.1 Lisätietoa
8-
91# And (ja) boolean lausekkeessa
102
11-**And** eli **ja** -operaatio antaa [[True|true]] eli tosi arvon vain silloin kun molemmat operandit ovat tosia (true). Muissa tapauksissa tuloksena on epätosi eli [[False|false]].
3+**And** eli **ja** -operaatio antaa [[True|true]] eli tosi arvon vain silloin kun molemmat operandit ovat tosia (true). Muissa tapauksissa tuloksena on epätosi eli [[False|false]].
124
135## And eli ja-operaation totuustaulukko
146
15-A | B | A and B (eli A ja B)
16----|---|---
17-false | false | false
18-false | true | false
19-true | false | false
20-true | true | true
21-
7+| A | B |   A and B (eli A ja B)   |
8+|:---------:|:---------:|--------------------------|
9+|   false   |   false   |   false |
10+|   false |   true |   false |
11+|   true |   false |   false |
12+|   true |   true |   true |
13+
2214# And eli ja bittikohtaisissa toiminnoissa
2315
24-Bitettäin tehtävä and (ja) asettaa kyseisen bitin ykköseksi (1) jos molemmat vastaavat bitit ovat ykkösiä (1). Muussa tapauksessa tulos on nolla (0).
16+Bitettäin tehtävä and (ja) asettaa kyseisen bitin ykköseksi (1) jos molemmat vastaavat bitit ovat ykkösiä (1). Muussa tapauksessa tulos on nolla (0).
2517
2618## Onko kakkosen potenssi
27-```
19+
20+``` pascal
2821function IsPowerOfTwo( const aValue : longint ): boolean;
29- var
30- x : longint;
31- b : boolean;
22+var
23+ x : longint;
24+ b : boolean;
25+begin
26+ b := false;
27+ if aValue <> 0 then
3228 begin
33- b := false;
34- if aValue <> 0 then
35- begin
36- x := aValue - 1;
37- x := x and aValue;
38- if x = 0 then b := true;
39- end;
40- result := b;
29+ x := aValue - 1;
30+ x := x and aValue;
31+ if x = 0 then b := true;
4132 end;
33+ result := b;
34+end;
4235```
4336
44-Jos kutsutaan IsPowerOfTwo(4) niin saadaan true. Jos kutsutaan IsPowerOfTwo(5) niin saadaan false .
37+Jos kutsutaan IsPowerOfTwo(4) niin saadaan true. Jos kutsutaan IsPowerOfTwo(5) niin saadaan false .
4538
4639### Lisätietoa
4740
48- * [[Not]]
49- * [[Shl]]
41+- [[Not]]
42+- [[Shl]]
5043
51- * [[Const/fi|Const]]
52- * [[Function]]
53- * [[Integer/fi|Integer]]
44+- [[Const/fi|Const]]
45+- [[Function]]
46+- [[Integer/fi|Integer]]
5447
55- * [[Shl|Clear a bit]]
48+- [[Shl|Clear a bit]]
5649
5750---
58-*From the Free Pascal wiki, page "And/fi", as the Internet Archive kept it on 2022-09-25. 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).*
51+*From the Free Pascal wiki, page "And/fi", as it stood on 2020-01-26 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).*
52+Category: Suomi

Back to history