Riad_ Bajraktarevic
/
Bajraktarevic_13_01_20
main
Diff: main.cpp
- Revision:
- 1:5fdd61b15b35
- Parent:
- 0:b44f9a2ebea2
- Child:
- 2:4eacbe2fa323
--- a/main.cpp Mon Jan 13 17:31:54 2020 +0000 +++ b/main.cpp Mon Jan 13 17:32:34 2020 +0000 @@ -21,4 +21,12 @@ - } \ No newline at end of file + } + + +int modifyBit (int x, uint8_t position, bool State) +{ + int mask = 1 << position; + int state = int(State); + return (x & ~mask) | ((state << position) & mask); +} \ No newline at end of file