3 ms·
Looking at the GCC source [1] starting at line 150 this is almost what GCC actually does - perform the multiplication with twice the operand size and then check
by danbruc 12y ago
Looking at the GCC source [1] starting at line 150 this is almost what GCC actually does - perform the multiplication with twice the operand size and then check by shifting right but GCC compares the result of two shift operations differing by one in the shift amount.
[1] https://github.com/mirrors/gcc/blob/master/libgcc/libgcc2.c https://github.com/mirrors/gcc/blob/master/libgcc/libgcc2.c
- stormbrew 12y agoFor future reference, you can link to a specific line in github with #LNNN. Which you can get by clicking on the line number. Pretty handy. https://github.com/mirrors/gcc/blob/master/libgcc/libgcc2.c#L151 https://github.com/mirrors/gcc/blob/master/libgcc/libgcc2.c#...