Bruno Allaire-Lemay
/
APP1test
df
Fork of APP1 by
Utility.hpp@12:1c341b119b23, 2017-01-15 (annotated)
- Committer:
- GaiSensei
- Date:
- Sun Jan 15 19:46:10 2017 +0000
- Revision:
- 12:1c341b119b23
- Parent:
- 9:12519f9dd3cd
- Child:
- 13:bb9669053eb3
Add utility function update_bit; ; Calculate new 4 byte value after changing a single bit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dupm2216 | 6:3facf0329142 | 1 | #ifndef UTILITY_HPP |
dupm2216 | 6:3facf0329142 | 2 | #define UTILITY_HPP |
dupm2216 | 6:3facf0329142 | 3 | |
dupm2216 | 6:3facf0329142 | 4 | namespace utility |
dupm2216 | 6:3facf0329142 | 5 | { |
dupm2216 | 6:3facf0329142 | 6 | const double PI = 3.14159265; |
dupm2216 | 6:3facf0329142 | 7 | |
dupm2216 | 6:3facf0329142 | 8 | bool is_almost_equal(double a, double b, double tolerance); |
dupm2216 | 6:3facf0329142 | 9 | |
dupm2216 | 6:3facf0329142 | 10 | //Return angle between 0 and 360 degree |
dupm2216 | 6:3facf0329142 | 11 | double wrap_angle(double angle); |
dupm2216 | 6:3facf0329142 | 12 | double degree_from_radian(const double angle_radian); |
GaiSensei | 12:1c341b119b23 | 13 | |
GaiSensei | 12:1c341b119b23 | 14 | //Calculate the 4 bytes required to represent a previous 4 bytes value |
GaiSensei | 12:1c341b119b23 | 15 | //after changing a single bit at a given position (position 0 being the LSB) |
GaiSensei | 12:1c341b119b23 | 16 | int update_bit(const int previous_byte, const int position, const bool new_bit_value); |
dupm2216 | 9:12519f9dd3cd | 17 | } |
dupm2216 | 6:3facf0329142 | 18 | |
dupm2216 | 6:3facf0329142 | 19 | #endif |