diff options
| author | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:08:27 +0200 |
|---|---|---|
| committer | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:08:27 +0200 |
| commit | c9b6b9a5ca082fe7c1b6f58d7713f785a9eb6a5c (patch) | |
| tree | 3e4f42f93c7ae89a364e4d51fff6e5cec4e55fa9 /rushs/evalexpr/test_a_bit | |
add: graphs et rushs
Diffstat (limited to 'rushs/evalexpr/test_a_bit')
| -rw-r--r-- | rushs/evalexpr/test_a_bit/is_set.c | 6 | ||||
| -rw-r--r-- | rushs/evalexpr/test_a_bit/is_set.h | 6 | ||||
| -rw-r--r-- | rushs/evalexpr/test_a_bit/test.c | 11 |
3 files changed, 23 insertions, 0 deletions
diff --git a/rushs/evalexpr/test_a_bit/is_set.c b/rushs/evalexpr/test_a_bit/is_set.c new file mode 100644 index 0000000..38fccf8 --- /dev/null +++ b/rushs/evalexpr/test_a_bit/is_set.c @@ -0,0 +1,6 @@ +#include "is_set.h" + +unsigned int is_set(unsigned int value, unsigned char n) +{ + return (value & (1 << (n - 1))) != 0; +} diff --git a/rushs/evalexpr/test_a_bit/is_set.h b/rushs/evalexpr/test_a_bit/is_set.h new file mode 100644 index 0000000..8f2fd9a --- /dev/null +++ b/rushs/evalexpr/test_a_bit/is_set.h @@ -0,0 +1,6 @@ +#ifndef IS_SET_H +#define IS_SET_H + +unsigned int is_set(unsigned int value, unsigned char n); + +#endif /* ! IS_SET_H */ diff --git a/rushs/evalexpr/test_a_bit/test.c b/rushs/evalexpr/test_a_bit/test.c new file mode 100644 index 0000000..e3403e4 --- /dev/null +++ b/rushs/evalexpr/test_a_bit/test.c @@ -0,0 +1,11 @@ +#include <stdio.h> + +#include "is_set.h" + +int main(void) +{ + printf("%d\n", is_set(24, 4)); + printf("%d\n", is_set(24, 3)); + + return 0; +} |
