int main(int argc, const char * argv[]) { unsigned long number = 0; unsigned long helperNumber = 1; for(int i = 0; i < sizeof(unsigned long) * 8; i++) { if (i % 2 == 0) { number |= helperNumber; } helperNumber <<= 1; } outputBits(number); printf("number = %lu\n", number); return 0; }
itpp::bvec Rsc::HardDecision(const itpp::vec &lambda) { int length = lambda.size(); itpp::bvec outputBits(length); for (int i = 0; i < length; ++i){ if (lambda[i] > 0){ outputBits[i] = 1; } // if else{ outputBits[i] = 0; } // else } // for i return outputBits; }
void OctreeElement::printDebugDetails(const char* label) const { unsigned char childBits = 0; for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { OctreeElement* childAt = getChildAtIndex(i); if (childAt) { setAtBit(childBits,i); } } QDebug elementDebug = qDebug().nospace(); QString resultString; resultString.sprintf("%s - Voxel at corner=(%f,%f,%f) size=%f\n isLeaf=%s isDirty=%s shouldRender=%s\n children=", label, (double)_cube.getCorner().x, (double)_cube.getCorner().y, (double)_cube.getCorner().z, (double)_cube.getScale(), debug::valueOf(isLeaf()), debug::valueOf(isDirty()), debug::valueOf(getShouldRender())); elementDebug << resultString; outputBits(childBits, &elementDebug); qDebug("octalCode="); printOctalCode(getOctalCode()); }