Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
Signed-off-by: begeekmyfriend <[email protected]>
  • Loading branch information
begeekmyfriend committed Jul 27, 2017
1 parent b2fc80d commit 03288e9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions 029_divide_two_integers/divide.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
#include <limits.h>

int divide(int dividend, int divisor) {
int sign = (float)dividend / divisor > 0 ? 1 : -1;
int sign = (float) dividend / divisor > 0 ? 1 : -1;
unsigned int dvd = dividend > 0 ? dividend : -dividend;
unsigned int dvs = divisor > 0 ? divisor : -divisor;

unsigned int bit_num[32];
unsigned int bit_num[33];
unsigned int i = 0;
long long d = dvs;

bit_num[i] = d;
while (d <= dvd) {
bit_num[++i] = d = d << 1;
Expand Down

0 comments on commit 03288e9

Please sign in to comment.