Home | History | Annotate | Download | only in Ia32
      1 /*++
      2 
      3 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
      4 This program and the accompanying materials
      5 are licensed and made available under the terms and conditions of the BSD License
      6 which accompanies this distribution.  The full text of the license may be found at
      7 http://opensource.org/licenses/bsd-license.php
      8 
      9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     11 
     12 Module Name:
     13 
     14   Power10U64.c
     15 
     16 Abstract:
     17 
     18   Calculates Operand * 10 ^ Power
     19 
     20 --*/
     21 
     22 #include "Tiano.h"
     23 
     24 UINT64
     25 MultU64x32 (
     26   IN UINT64   Multiplicand,
     27   IN UINTN    Multiplier
     28   );
     29 
     30 UINT64
     31 Power10U64 (
     32   IN UINT64   Operand,
     33   IN UINTN    Power
     34   )
     35 /*++
     36 
     37 Routine Description:
     38 
     39   Raise 10 to the power of Power, and multiply the result with Operand
     40 
     41 Arguments:
     42 
     43   Operand  - multiplicand
     44   Power    - power
     45 
     46 Returns:
     47 
     48   Operand * 10 ^ Power
     49 
     50 --*/
     51 {
     52   __asm {
     53   mov    eax, dword ptr Operand[0]
     54   mov    edx, dword ptr Operand[4]
     55   mov    ecx, Power
     56   jcxz   _Power10U64_Done
     57 
     58 _Power10U64_Wend:
     59   push   ecx
     60   push   10
     61   push   dword ptr Operand[4]
     62   push   dword ptr Operand[0]
     63   call   MultU64x32
     64   add    esp, 0Ch
     65   pop    ecx
     66   mov    dword ptr Operand[0], eax
     67   mov    dword ptr Operand[4], edx
     68   loop   _Power10U64_Wend
     69 
     70 _Power10U64_Done:
     71   }
     72 }
     73