added setAtBit() utility

This commit is contained in:
ZappoMan 2013-05-14 11:09:53 -07:00
parent d59a8143d7
commit 2c1518144a
2 changed files with 6 additions and 0 deletions

View file

@ -94,6 +94,11 @@ bool oneAtBit(unsigned char byte, int bitIndex) {
return (byte >> (7 - bitIndex) & 1);
}
void setAtBit(unsigned char& byte, int bitIndex) {
byte += (1 << (7 - bitIndex));
}
void switchToResourcesParentIfRequired() {
#ifdef __APPLE__
CFBundleRef mainBundle = CFBundleGetMainBundle();

View file

@ -49,6 +49,7 @@ void outputBits(unsigned char byte, bool withNewLine = true);
void printVoxelCode(unsigned char* voxelCode);
int numberOfOnes(unsigned char byte);
bool oneAtBit(unsigned char byte, int bitIndex);
void setAtBit(unsigned char& byte, int bitIndex);
void switchToResourcesParentIfRequired();