int add(int x, int y) { int c; while(y) { c = x & y; x ^= y; y = c << 1; } return(x); } int mult(int x, int y) { int p = 0, s = y; if(y < 0) y = add(~y,1); while(y) { if(y & 1) p = add(x, p); x <<= 1; y >>= 1; } if(s < 0) p = add(~p,1); return(p); }
-- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.