- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.cpp
More file actions
Latest commit
25 lines (20 loc) · 666 Bytes
/
Copy pathutils.cpp
File metadata and controls
25 lines (20 loc) · 666 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include"utils.h"
usingnamespaceUtils;
usingnamespacestd::chrono;
uint8_tUtils::GetBit (uint8_t Value, uint8_t BitNo) {
return (Value & (1 << BitNo)) != 0;
}
voidUtils::SetBit (uint8_t &Value, uint8_t BitNo, uint8_t Set) {
if (Set)
Value |= 1 << BitNo;
else
Value &= 0xFF ^ (1 << BitNo);
}
voidUtils::MicroSleep (uint32_t us) {
structtimespec req = {0, us * 1000};
nanosleep (&req, (structtimespec *) NULL);
}
uint64_tUtils::GetCurrentTime (time_point <high_resolution_clock>* StartTime) {
auto TimeDifference = high_resolution_clock::now () - *StartTime;
return duration_cast <microseconds> (TimeDifference).count (); // In Microseconds
}