I am going through an algorithms and datastructures textbook and came accross this question:
1-28. Write a function to perform integer division withou
unsigned bitdiv (unsigned a, unsigned d) { unsigned res,c; for (c=d; c <= a; c <<=1) {;} for (res=0;(c>>=1) >= d; ) { res <<= 1; if ( a >= c) { res++; a -= c; } } return res; }