mirror of
https://gitlab.com/80486DX2-66/gists
synced 2024-11-14 02:15:53 +05:30
bool-operations.c: optimize printf(s "\n")
to puts(s)
This commit is contained in:
parent
1ff2eec112
commit
5a785bfd9f
@ -19,29 +19,29 @@
|
|||||||
int main(void) {
|
int main(void) {
|
||||||
bool boolean = false;
|
bool boolean = false;
|
||||||
unsigned char integer = (unsigned char) boolean;
|
unsigned char integer = (unsigned char) boolean;
|
||||||
printf("Loop:\n");
|
puts("Loop:");
|
||||||
for (uint8_t i = 0; i < 3; i++) {
|
for (uint8_t i = 0; i < 3; i++) {
|
||||||
SHOW_BOOL_INT;
|
SHOW_BOOL_INT;
|
||||||
boolean++; integer++;
|
boolean++; integer++;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n* 2:\n");
|
puts("\n* 2:");
|
||||||
boolean *= 2; integer *= 2;
|
boolean *= 2; integer *= 2;
|
||||||
SHOW_BOOL_INT;
|
SHOW_BOOL_INT;
|
||||||
|
|
||||||
printf("\n<< 1:\n");
|
puts("\n<< 1:");
|
||||||
boolean <<= 1; integer <<= 1;
|
boolean <<= 1; integer <<= 1;
|
||||||
SHOW_BOOL_INT;
|
SHOW_BOOL_INT;
|
||||||
|
|
||||||
printf("\n/ 2:\n");
|
puts("\n/ 2:");
|
||||||
boolean /= 2; integer /= 2;
|
boolean /= 2; integer /= 2;
|
||||||
SHOW_BOOL_INT;
|
SHOW_BOOL_INT;
|
||||||
|
|
||||||
printf("\n^ 0x10:\n");
|
puts("\n^ 0x10:");
|
||||||
boolean ^= 0x10; integer ^= 0x10;
|
boolean ^= 0x10; integer ^= 0x10;
|
||||||
SHOW_BOOL_INT;
|
SHOW_BOOL_INT;
|
||||||
|
|
||||||
printf("\n>> 1:\n");
|
puts("\n>> 1:");
|
||||||
boolean >>= 1; integer >>= 1;
|
boolean >>= 1; integer >>= 1;
|
||||||
SHOW_BOOL_INT;
|
SHOW_BOOL_INT;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user