Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Code Block
1. esimerkki, a = 255 & 15 = 11111111b & 00001111b = 00001111b = 15 = 0xE0x0E = 017
2. esimerkki, a = 255 &  1 = 11111111b & 00000001b = 00000001b = 1  = 0x10x01 =  01001
3. esimerkki, a =   2 &  1 = 00000010b & 00000001b = 00000000b = 0  = 0x10x01 =  00000
4. esimerkki, a =   3 &  1 = 00000011b & 00000001b = 00000001b = 1
5. esimerkki, a =   3 &  2 = 00000011b & 00000010b = 00000010b = 2

...

Code Block
1. esimerkki, a = 0 |  1 = 00000000b | 00000001b = 00000001b =  1
2. esimerkki, a = 2 |  1 = 00000010b | 00000001b = 00000011b =  3
3. esimerkki, a = 4 |  8 = 00000100b | 00001000b = 00001100b = 12 = 0xC0x0C = 014
4. esimerkki, a = 4 | 12 = 00000100b | 00001100b = 00001100b = 12

...

Code Block
1. esimerkki, a = 0 ^  1 = 00000000b ^ 0000 0001b = 00000001b = 1
2. esimerkki, a = 1 ^  1 = 00000001b ^ 0000 0001b = 00000000b = 0
3. esimerkki, a = 2 ^  1 = 00000010b ^ 0000 0001b = 00000011b = 3
4. esimerkki, a = 3 ^  1 = 00000011b ^ 0000 0001b = 00000000b00000010b = 2
5. esimerkki, a = 4 ^  8 = 00000100b ^ 0000 1000b = 00001100b = 12 = 0xC = 014
6. esimerkki, a = 4 ^ 12 = 00000100b ^ 0000 1100b = 00001000b = 8  = 0x8 = 010

Negaatio, operaattori ~,  Negaatio-operaattori kääntää kaikki muuttujan bitit päinvastaiseksi 

Code Block
1. esimerkki, a =  0 = 00000000b operaatio a = ~a; nyt a = 11111111b, lopputulos a = 255 = 0xFF = 0377
2. esimerkki, a =  1 = 00000001b operaatio a = ~a; nyt a = 11111110b, lopputulos a = 254 = 0xFE = 0376
3. esimerkki, a = 12 = 00001100b operaatio a = ~a; nyt a = 11110011b, lopputulos a = 243 = 0xF3 = 0363
4. esimerkki, a = 15 = 00001111b operaatio a = ~a; nyt a = 11110000b, lopputulos a = 240 = 0xF0 = 0360

Siirto vasemmalle  Shifting left, operaattori <<

...