svgtopt/gfx2d/src/GfxMultiply.s
changeset 0 d46562c3d99d
equal deleted inserted replaced
-1:000000000000 0:d46562c3d99d
       
     1 /*
       
     2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Graphics Extension Library source file
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 @ 
       
    21 @   GfxMultiplyAsm - Multiply a 16:16 fixed point factor into iValue.
       
    22 @
       
    23 @       This function multiplies a 16:16 fixed point factor into iValue using
       
    24 @   an ARM 64 bit multiply instruction.  This is much faster than using the
       
    25 @   Symbian TInt64 class.  Note that iValue MUST be the first data member of
       
    26 @   this class.
       
    27 @
       
    28 @       r0 = Pointer to iValue (First data item in TFixPt class).
       
    29 @       r1 = Second factor to multiply.
       
    30 
       
    31         .align  2
       
    32         .globl  GfxMultiplyAsm__6TFixPti
       
    33         .thumb_func
       
    34         .code   16
       
    35 
       
    36 GfxMultiplyAsm__6TFixPti:
       
    37 
       
    38         add     r2, pc, #4            @ Switch from Thumb to ARM execution.
       
    39         bx      r2
       
    40         nop
       
    41 
       
    42         .align  2
       
    43         .code   32
       
    44 
       
    45         ldr     r2, [r0]              @ r2 = *this, r1 = aVal.iValue.
       
    46         smull   r3, r2, r1, r2        @ r2:r3 = iValue * aVal.iValue.
       
    47         mov     r2, r2, lsl #16
       
    48         orr     r2, r2, r3, lsr #16   @ Extract middle 32 bits from 64 bit product.
       
    49         str     r2, [r0]              @ Store into iValue.
       
    50         bx      lr
       
    51