home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / system / source / a64_int128.asm < prev    next >
Encoding:
Assembly Source File  |  2009-09-14  |  2.3 KB  |  74 lines

  1. ;    VirtualDub - Video processing and capture application
  2. ;    System library component
  3. ;    Copyright (C) 1998-2004 Avery Lee, All Rights Reserved.
  4. ;
  5. ;    Beginning with 1.6.0, the VirtualDub system library is licensed
  6. ;    differently than the remainder of VirtualDub.  This particular file is
  7. ;    thus licensed as follows (the "zlib" license):
  8. ;
  9. ;    This software is provided 'as-is', without any express or implied
  10. ;    warranty.  In no event will the authors be held liable for any
  11. ;    damages arising from the use of this software.
  12. ;
  13. ;    Permission is granted to anyone to use this software for any purpose,
  14. ;    including commercial applications, and to alter it and redistribute it
  15. ;    freely, subject to the following restrictions:
  16. ;
  17. ;    1.    The origin of this software must not be misrepresented; you must
  18. ;        not claim that you wrote the original software. If you use this
  19. ;        software in a product, an acknowledgment in the product
  20. ;        documentation would be appreciated but is not required.
  21. ;    2.    Altered source versions must be plainly marked as such, and must
  22. ;        not be misrepresented as being the original software.
  23. ;    3.    This notice may not be removed or altered from any source
  24. ;        distribution.
  25.  
  26.         segment    .text
  27.  
  28.         global    vdasm_uint128_add
  29. vdasm_uint128_add:
  30.         mov        rax, [rdx]
  31.         add        rax, [r8]
  32.         mov        [rcx], rax
  33.         mov        rax, [rdx+8]
  34.         adc        rax, [r8+8]
  35.         mov        [rcx+8], rax
  36.         ret
  37.  
  38.         global    vdasm_uint128_sub
  39. vdasm_uint128_sub:
  40.         mov        rax, [rdx]
  41.         sub        rax, [r8]
  42.         mov        [rcx], rax
  43.         mov        rax, [rdx+8]
  44.         sbb        rax, [r8+8]
  45.         mov        [rcx+8], rax
  46.         ret
  47.  
  48. proc_frame vdasm_uint128_mul
  49.         mov        [esp+8], rbx
  50.         [savereg    rbx, 8]
  51.         mov        [esp+16], rsi
  52.         [savereg    rsi, 16]
  53. end_prolog
  54.  
  55.         mov        rbx, rdx            ;rbx = src1
  56.         mov        rax, [rdx]            ;rax = src1a
  57.         mov        rsi, [r8]            ;rsi = src2a
  58.         mul        rsi                    ;rdx:rax = src1a*src2a
  59.         mov        [rcx], rax            ;write low result
  60.         mov        r9, rdx                ;r9 = (src1a*src2a).hi
  61.         mov        rax, [rbx+8]        ;rax = src1b
  62.         mul        rsi                    ;rdx:rax = src1b*src2a
  63.         add        r9, rax                ;r9 = (src1a*src2a).hi + (src1b*src2a).lo
  64.         mov        rax, [rbx]            ;rax = src1a
  65.         mul        qword [r8+8]    ;rdx:rax = src1a*src2b
  66.         add        rax, r9                ;rax = (src1a*src2b).lo + (src1b*src2a).lo + (src1a*src2a).hi
  67.         mov        [rcx+8], rax        ;write high result
  68.         mov        rsi, [esp+16]
  69.         mov        rbx, [esp+8]
  70.         ret
  71. endproc_frame
  72.  
  73.         end
  74.