MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / updateIthBit

Function updateIthBit

CPP/bitmasking/bit-functions.cpp:20–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18 n=n&mask;
19}
20void updateIthBit(int &n,int i,int v){
21 clearIthBit(n,i);
22 int mask=(v<<i);
23 n=n|mask;
24}
25void clearLastIthBit(int &n,int i){
26 int mask= (-1<<i);
27 n=n&mask;

Callers

nothing calls this directly

Calls 1

clearIthBitFunction · 0.85

Tested by

no test coverage detected