Tree Structured Communication
int Ceiling_log2(int x /* in */) {
/* Use unsigned so that right shift will fill
* leftmost bit with 0
*/
unsigned temp = (unsigned) x - 1;
int result = 0;
while (temp != 0) {
temp = temp >> 1;
result = result + 1 ;
}
return result;
} /* Ceiling_log2 */
Previous slide
Next slide
Back to first slide
View graphic version