⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 div.s

📁 flintc库文件及源码C语言大数支持函数库包括DESRSA算法
💻 S
📖 第 1 页 / 共 2 页
字号:
#.d3:    cmpl    $14,%esi        jb      .d3a        pushl   %edi        movl    a(%ebp,%esi),%edx      # uj   unshifed in dx (hiWord)        movl    a-4(%ebp,%esi),%eax    # uj+1 unshifted        movl    a-8(%ebp,%esi),%ebx    # uj+2 unshifted        movl    a-12(%ebp,%esi),%edi   # uj+3 unshifted        pushl   %ecx        movw    d(%ebp),%cx.l12:   cmpw    $0,%cx        je      .l13        rcll    $1,%edi        rcll    $1,%ebx        rcll    $1,%eax        rcll    $1,%edx        decw    %cx        jmp     .l12.l13:   popl    %ecx        popl    %edi        jmp     .qhat#.d3a:   movl    a(%ebp,%esi),%edx      # uj   unshifted        movl    a-4(%ebp,%esi),%eax    # uj+1 unshifted        movl    a-8(%ebp,%esi),%ebx    # uj+2 unshifted        pushl   %ecx        movw    d(%ebp),%cx.l14:   cmpw    $0,%cx        je      .l15        rcll    $1,%ebx        rcll    $1,%eax        rcll    $1,%edx        decw    %cx        jmp     .l14.l15:   popl    %ecx##-----> Calculate and test qhat#.qhat:  movl    %eax,uj1(%ebp)  # Store shifted uj+1         movl    %ebx,uj2(%ebp)  # Store shifted uj+2        movl    v1(%ebp),%ebx   # v1 in bx        cmpl    %edx,%ebx        je      .bm1		# If v1 = uj q = b - 1#        divl    %ebx		# eax <- qhat# edx <- rhat: = uj*b + uj+1 -qhat*v1 = (uj*b + uj+1) mod v1        movl    %eax,q1(%ebp)   # Store qhat        cmpl    $0,%eax        jne     .l16        jmp     .dml		# If q = 0 process next digit#.bm1:   movl    $0x0ffffffff,%eax       # eax <- qhat        movl    %eax,q1(%ebp)   # Store qhat        movl    uj1(%ebp),%edx  # edx <- uj+1        addl    v1(%ebp),%edx   # edx <- uj+1 + v1 =: rhat        jc      .d4		# rhat >= b => v2 * qhat < rhat * b#.l16:   movl    %edx,%ebx       # ebx <- rhat        mull    v2(%ebp)        # eax <- low(qhat * v2), edx <- high(qhat * v2)        cmpl    %ebx,%edx       # rhat >= high(qhat * v2) ?        jb      .d4		# CF == 1?  Then we're done        ja      .l17		# rhat < high(qhat * v2) => decrement qhat        cmpl    uj2(%ebp),%eax  # uj+2 >= low(qhat * v2) ?        jbe     .d4		# CF == 1 OR ZF == 1? Then we're done#.l17:   decl    q1(%ebp)        # Correct qhat--        addl    v1(%ebp),%ebx   # ebx <- rhat + v1        jc      .d4		# rhat >= b => v2 * qhat < rhat * b        subl    v2(%ebp),%eax   # (qhat * v2) - v2        sbb     $0,%edx#        cmpl    %ebx,%edx       # rhat >= high(qhat * v2) ?        jb      .d4		# CF == 1?  Then we're done        ja      .l17		# rhat < high(qhat * v2) => decrement qhat        cmpl    uj2(%ebp),%eax  # uj+2 >= low(qhat * v2) ?        ja      .l17     # CF==0 + ZF==0? => Repeat decrement of qhat#.d4:    pushl   %ecx		# Store main counter        pushl   %esi		# Store j + l(b)         pushl   %edi		# Store j        movw    b(%ebp),%cx     # Load counter with l(b)        shrw    $1,%cx        jnc     .d4a        incw    %cx.d4a:   movl    q1(%ebp),%ebx   # q in bx        movl    $2,%esi        movl    $0,%edx		# Dummy carry##-----> Multiplication and subtraction#.dms:   push    %edx        movl    %ebx,%eax       # q in ax        mull    b(%ebp,%esi)    # hi:dx lo:ax        subl    %eax,a(%ebp,%edi)        adcl    $0,%edx		# Carry to next subtrahend        popl    %eax        subl    %eax,a(%ebp,%edi)        adcl    $0,%edx		# Carry to next subtrahend        incl    %edi        incl    %edi        incl    %edi        incl    %edi        incl    %esi        incl    %esi        incl    %esi        incl    %esi        loop    .dms        subl    %edx,a(%ebp,%edi)        jnc     .dnc		# No correction necessary if carry = 0##-----> Correction#        popl    %edi        pushl   %edi        xorl    %ecx,%ecx        movw    b(%ebp),%cx     # Load counter with l(b)        shrw    $1,%cx        jnc     .d4b        incw    %cx.d4b:   movl    $2,%esi        clc     .d5:    movl    b(%ebp,%esi),%eax       # b[i]        adcl    %eax,a(%ebp,%edi)       # a[j+i] + b[i]        incl    %edi        incl    %edi        incl    %edi        incl    %edi        incl    %esi        incl    %esi        incl    %esi        incl    %esi        loop    .d5		# Outer loop        jnc     .d51        incl    a(%ebp,%edi).d51:   decl    q1(%ebp)        # q = q - 1##.dnc:   popl    %edi		# Get pointers and counters        popl    %esi        popl    %ecx.dml:   movl    q1(%ebp),%eax   # Get q        movl    %eax,q(%ebp,%edi)       # q[j] = q        subl    $4,%edi        subl    $4,%esi        decl    %ecx		# Inner loop        jz      .d6        jmp     .d3#.d6:    popl    %edi		# Load length l(a)-l(b)-1 in ULONGs        addl    $2,%edi		# di points to loByte of last USHORT        movl    $0,%eax.l18:   cmpw    q(%ebp,%edi),%ax        # q[l(a)-l(b)]=0 ?        jne     .d7		# If so ...        decl    %edi        decl    %edi		# ... l(q) = l(a) - l(b) - 1        cmpl    $0,%edi        jne     .l18.d7:    movl    %edi,%edx        shrl    $1,%edx		# l(q) (#USHORTs) in dx        movw    %dx,q(%ebp)     # Store l(q)##-----> Determine length of remainder#        movl    $0,%eax        movw    b(%ebp),%ax        movl    %eax,%ecx        shlw    $1,%ax        movl    %eax,%edi        movl    $0,%ebx        incl    %edi        incl    %edi.d8:    decl    %edi        decl    %edi		# di points to loByte of a[l(b)]        cmpw    %bx,a(%ebp,%edi)        loope   .d8        jz      .d9		# If a[bp][di]!= 0 ...        incw    %cx		# ... l has to be incremented.d9:    movw    %cx,a(%ebp)     # Store l(r)##-----> Store results#.dstore: 	movl    %ebp,%esi        movl    %ebp,%ebx        popl    %ebp        pushl   %esi        addl    $q,%esi        movl    16(%ebp),%edi   # Offset of quotient        movl    $0,%ecx        movw    (%esi),%cx        shrw    $1,%cx        jnc     .l19        incw    %cx.l19:   cld             cmpw    $0,%cx        je      .qzero        rep     	movsl   .qzero: movsw   ##-----> Store remainder#        popl    %esi.drs:                    movl    20(%ebp),%edi        addl    $a,%esi        movl    $0,%ecx        movw    (%esi),%cx        shrw    $1,%cx        jnc     .l20        incw    %cx.l20:   cld             cmpw    $0,%cx        je      .rzero        rep     	movsl   .rzero: movsw           movl    $0,%eax		# Return-Value = 0: OK##*******************************************************************************#       Security: Purge stackdivret: movl    %ebx,%edi        movl    $(WORKSP-4)/4,%ecx        cld             rep     	stosl			# Overwrite with  0 or -1#*******************************************************************************#        popl    %esi        popl    %edi        popl    %ebx        movl    %ebp,%esp        popl    %ebp        ret     ##.divz:  movl    $0,%eax		# Return-Value = 0: Everything OK         movl    20(%ebp),%edi   # Destination Offset of remainder         movl    16(%ebp),%esi   # Destination offset of quotient          movw    %ax,(%edi)      # Remainder = 0                           movw    %ax,(%esi)      # Quotient = 0                            jmp     divret#.divbyz: 	movl    $-1,%eax        jmp     divret		# Return-Value = -1: Division by zero##-----> Case q = 0 and r = a#.dra:   movl    %ebp,%esi        movl    %ebp,%ebx        popl    %ebp        movl    16(%ebp),%edi        movw    $0,(%edi)       # q = 0        jmp     .drs		# Store remainder###>>>>>> Short Division##.dshort: 	movl    $0,%ecx        movw    a(%ebp),%cx        shrw    $1,%cx        jnc     .dsh0        incw    %cx.dsh0:  movl    %ecx,%edi        shll    $2,%edi        subl    $2,%edi        movl    $0,%edx        movl    b+2(%ebp),%ebx.dsh1:  movl    a(%ebp,%edi),%eax        divl    %ebx        movl    %eax,q(%ebp,%edi)        subl    $4,%edi        loop    .dsh1.dsh2:  movl    $0,%ecx        movw    a(%ebp),%cx        movl    %ecx,%esi        shll    $1,%esi.l21:   movw    q(%ebp,%esi),%bx        cmpw    $0,%bx        jne     .dsh3        decl    %esi        decl    %esi        decl    %ecx        cmpw    $0,%cx        jne     .l21.dsh3:  movw    %cx,q(%ebp)        movl    %edx,a+2(%ebp)        movw    $2,a(%ebp)        cmpw    $0,a+4(%ebp)        jne     .dst        movw    $1,a(%ebp)        cmpw    $0,a+2(%ebp)        jne     .dst        movw    $0,a(%ebp).dst:   jmp     .dstore#

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -