source: bootcd/isolinux/syslinux-6.03/gnu-efi/gnu-efi-3.0/lib/ia64/math.c @ e16e8f2

Last change on this file since e16e8f2 was e16e8f2, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

bootstuff

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*++
2
3Copyright (c) 1998  Intel Corporation
4
5Module Name:
6
7    math.c
8
9Abstract:
10
11
12
13
14Revision History
15
16--*/
17
18#include "lib.h"
19
20
21//
22// Declare runtime functions
23//
24
25#ifdef RUNTIME_CODE
26#ifndef __GNUC__
27#pragma RUNTIME_CODE(LShiftU64)
28#pragma RUNTIME_CODE(RShiftU64)
29#pragma RUNTIME_CODE(MultU64x32)
30#pragma RUNTIME_CODE(DivU64x32)
31#endif
32#endif
33
34//
35//
36//
37
38
39
40
41UINT64
42LShiftU64 (
43    IN UINT64   Operand,
44    IN UINTN    Count
45    )
46// Left shift 64bit by 32bit and get a 64bit result
47{
48    return Operand << Count;
49}
50
51UINT64
52RShiftU64 (
53    IN UINT64   Operand,
54    IN UINTN    Count
55    )
56// Right shift 64bit by 32bit and get a 64bit result
57{
58    return Operand >> Count;
59}
60
61
62UINT64
63MultU64x32 (
64    IN UINT64   Multiplicand,
65    IN UINTN    Multiplier
66    )
67// Multiple 64bit by 32bit and get a 64bit result
68{
69    return Multiplicand * Multiplier;
70}
71
72UINT64
73DivU64x32 (
74    IN UINT64   Dividend,
75    IN UINTN    Divisor,
76    OUT UINTN   *Remainder OPTIONAL
77    )
78// divide 64bit by 32bit and get a 64bit result
79// N.B. only works for 31bit divisors!!
80{
81    ASSERT (Divisor != 0);
82
83    if (Remainder) {
84        *Remainder = Dividend % Divisor;
85    }
86
87    return Dividend / Divisor;
88}
Note: See TracBrowser for help on using the repository browser.