aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/lib/div64.S
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2005-10-19 19:37:02 -0400
committerPaul Mackerras <paulus@samba.org>2005-10-19 19:37:02 -0400
commit344480b99730bfd205e306d3fd168cdcebe83425 (patch)
tree43e3d75779307d9ee36f001718efe6ef6fa220d3 /arch/powerpc/lib/div64.S
parenta4bcc95a3ad0ccba6d7b39442dfb81cc57bb7121 (diff)
powerpc: Fix a corner case in __div64_32
The code was incorrectly doing a division by 0 in the case where the denominator was 0x100000000 and the divisor was 0xffffffff. Thanks to Fred Liu of Motorola for pointing this out. Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/lib/div64.S')
-rw-r--r--arch/powerpc/lib/div64.S3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/powerpc/lib/div64.S b/arch/powerpc/lib/div64.S
index 3527569e9926..83d9832fd919 100644
--- a/arch/powerpc/lib/div64.S
+++ b/arch/powerpc/lib/div64.S
@@ -33,9 +33,10 @@ _GLOBAL(__div64_32)
33 cntlzw r0,r5 # we are shifting the dividend right 33 cntlzw r0,r5 # we are shifting the dividend right
34 li r10,-1 # to make it < 2^32, and shifting 34 li r10,-1 # to make it < 2^32, and shifting
35 srw r10,r10,r0 # the divisor right the same amount, 35 srw r10,r10,r0 # the divisor right the same amount,
36 add r9,r4,r10 # rounding up (so the estimate cannot 36 addc r9,r4,r10 # rounding up (so the estimate cannot
37 andc r11,r6,r10 # ever be too large, only too small) 37 andc r11,r6,r10 # ever be too large, only too small)
38 andc r9,r9,r10 38 andc r9,r9,r10
39 addze r9,r9
39 or r11,r5,r11 40 or r11,r5,r11
40 rotlw r9,r9,r0 41 rotlw r9,r9,r0
41 rotlw r11,r11,r0 42 rotlw r11,r11,r0