41 lines
853 B
C++
41 lines
853 B
C++
#include "operators.hpp"
|
|||
|
|
|
||
|
|
namespace fundamentals {
|
||
|
|
|
||
|
|
auto absolute_difference(int lhs, int rhs) -> int {
|
||
|
|
// TODO: Return |lhs - rhs| without using std::abs.
|
||
|
|
(void)lhs;
|
||
|
|
(void)rhs;
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
auto is_in_range(int value, int min, int max) -> bool {
|
||
|
|
// TODO: Return true when min <= value <= max (inclusive).
|
||
|
|
(void)value;
|
||
|
|
(void)min;
|
||
|
|
(void)max;
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
auto count_set_bits(std::uint8_t value) -> int {
|
||
|
|
// TODO: Count how many bits are set to 1.
|
||
|
|
(void)value;
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
auto logical_and(bool lhs, bool rhs) -> bool {
|
||
|
|
// TODO: Implement logical AND without using &&.
|
||
|
|
(void)lhs;
|
||
|
|
(void)rhs;
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
auto logical_or(bool lhs, bool rhs) -> bool {
|
||
|
|
// TODO: Implement logical OR without using ||.
|
||
|
|
(void)lhs;
|
||
|
|
(void)rhs;
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
} // namespace fundamentals
|