bit_manipulation_101
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| bit_manipulation_101 [2021/05/10 07:19] – ptitfrap | bit_manipulation_101 [2021/05/10 07:24] (Version actuelle) – ptitfrap | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | ====== Bit Manipulation 101 ====== | ||
| + | |||
| ==== OR ==== | ==== OR ==== | ||
| pour mettre un bit a 1 | pour mettre un bit a 1 | ||
| Ligne 18: | Ligne 20: | ||
| ==== FLAG ==== | ==== FLAG ==== | ||
| + | <sxh cpp> | ||
| uint8_t FLAGS = 0; | uint8_t FLAGS = 0; | ||
| - | # | + | # |
| - | # | + | # |
| - | # | + | # |
| - | # | + | # |
| + | sbi(FLAGS, | ||
| + | |||
| + | if (FLAGS & _BV(F_f1)) //si flag ON | ||
| + | |||
| + | if (!(FLAGS & _BV(F_f2))) //si flag OFF | ||
| + | |||
| + | cbi(FLAGS, | ||
| + | </ | ||
bit_manipulation_101.1620623990.txt.gz · Dernière modification : 2021/05/10 07:19 de ptitfrap
