MCPcopy Create free account
hub / github.com/OpenHD/OpenHD / get_nth_bit

Method get_nth_bit

OpenHD/ohd_common/src/openhd_util.cpp:333–336  ·  view source on GitHub ↗

https://codeforwin.org/c-programming/c-program-to-get-value-of-nth-bit-of-number

Source from the content-addressed store, hash-verified

331
332// https://codeforwin.org/c-programming/c-program-to-get-value-of-nth-bit-of-number
333bool OHDUtil::get_nth_bit(long number, int position) {
334 const bool bit_status = (number >> position) & 1;
335 return bit_status;
336}
337
338void OHDUtil::ltrim(std::string& s) {
339 s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected