Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
bit_set.cpp@4:9b24dd4dff68, 2019-09-10 (annotated)
- Committer:
- yosino_adati
- Date:
- Tue Sep 10 01:03:23 2019 +0000
- Revision:
- 4:9b24dd4dff68
- Parent:
- 3:2a301290cf76
henkou wo kuwaemashita.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yosino_adati | 0:e260b26ee5fb | 1 | #include "bit_set.h" |
yosino_adati | 0:e260b26ee5fb | 2 | |
yosino_adati | 2:eeaee1039d50 | 3 | void bitini(char var) |
yosino_adati | 1:4b6bf9473b7d | 4 | { |
yosino_adati | 1:4b6bf9473b7d | 5 | var &= 0x00; |
yosino_adati | 1:4b6bf9473b7d | 6 | } |
yosino_adati | 0:e260b26ee5fb | 7 | |
yosino_adati | 2:eeaee1039d50 | 8 | void bitset(char var,int cons) |
yosino_adati | 1:4b6bf9473b7d | 9 | { |
yosino_adati | 3:2a301290cf76 | 10 | var |= 0x01<<cons; |
yosino_adati | 1:4b6bf9473b7d | 11 | } |
yosino_adati | 0:e260b26ee5fb | 12 | |
yosino_adati | 2:eeaee1039d50 | 13 | void bitclear(char var,int cons) |
yosino_adati | 1:4b6bf9473b7d | 14 | { |
yosino_adati | 3:2a301290cf76 | 15 | var &= ~(0x01<<cons); |
yosino_adati | 1:4b6bf9473b7d | 16 | } |
yosino_adati | 2:eeaee1039d50 | 17 | |
yosino_adati | 2:eeaee1039d50 | 18 | void bit_ini(char* var) |
yosino_adati | 2:eeaee1039d50 | 19 | { |
yosino_adati | 2:eeaee1039d50 | 20 | *var &= 0x00; |
yosino_adati | 2:eeaee1039d50 | 21 | } |
yosino_adati | 0:e260b26ee5fb | 22 | |
yosino_adati | 2:eeaee1039d50 | 23 | void bit_set(char* var,int cons) |
yosino_adati | 2:eeaee1039d50 | 24 | { |
yosino_adati | 3:2a301290cf76 | 25 | *var |= 0x01<<cons; |
yosino_adati | 2:eeaee1039d50 | 26 | } |
yosino_adati | 2:eeaee1039d50 | 27 | |
yosino_adati | 2:eeaee1039d50 | 28 | void bit_clear(char* var,int cons) |
yosino_adati | 2:eeaee1039d50 | 29 | { |
yosino_adati | 3:2a301290cf76 | 30 | *var &= ~(0x01<<cons); |
yosino_adati | 2:eeaee1039d50 | 31 | } |
yosino_adati | 2:eeaee1039d50 | 32 | |
yosino_adati | 4:9b24dd4dff68 | 33 | bool bittest(char var,int cons) |
yosino_adati | 1:4b6bf9473b7d | 34 | { |
yosino_adati | 3:2a301290cf76 | 35 | return (var &= 0x01<<cons)?true:false; |
yosino_adati | 1:4b6bf9473b7d | 36 | } |