Sign in Join
Wiki copytemporary

And/fi: what changed

Revision 1 to 2. 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+
19# And (ja) boolean lausekkeessa
210
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]].
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]].
412
513## And eli ja-operaation totuustaulukko
614
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-
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+
1422# And eli ja bittikohtaisissa toiminnoissa
1523
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).
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).
1725
1826## Onko kakkosen potenssi
19-
20-``` pascal
27+```
2128function IsPowerOfTwo( const aValue : longint ): boolean;
22-var
23- x : longint;
24- b : boolean;
25-begin
26- b := false;
27- if aValue <> 0 then
29+ var
30+ x : longint;
31+ b : boolean;
2832 begin
29- x := aValue - 1;
30- x := x and aValue;
31- if x = 0 then b := true;
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;
3241 end;
33- result := b;
34-end;
3542```
3643
37-Jos kutsutaan IsPowerOfTwo(4) niin saadaan true. Jos kutsutaan IsPowerOfTwo(5) niin saadaan false .
44+Jos kutsutaan IsPowerOfTwo(4) niin saadaan true. Jos kutsutaan IsPowerOfTwo(5) niin saadaan false .
3845
3946### Lisätietoa
4047
41-- [[Not]]
42-- [[Shl]]
48+ * [[Not]]
49+ * [[Shl]]
4350
44-- [[Const/fi|Const]]
45-- [[Function]]
46-- [[Integer/fi|Integer]]
51+ * [[Const/fi|Const]]
52+ * [[Function]]
53+ * [[Integer/fi|Integer]]
4754
48-- [[Shl|Clear a bit]]
55+ * [[Shl|Clear a bit]]
4956
5057---
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
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).*

Back to history