Source code of Windows XP (NT5)
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
/*++
Copyright (c) 1998 Intel Corporation
Module Name:
math.c
Abstract:
Revision History
--*/
#include "lib.h"
/*
* Declare runtime functions */
#ifdef RUNTIME_CODE
#pragma RUNTIME_CODE(LShiftU64)
#pragma RUNTIME_CODE(RShiftU64)
#pragma RUNTIME_CODE(MultU64x32)
#pragma RUNTIME_CODE(DivU64x32)
#endif
/*
* */
UINT64 LShiftU64 ( IN UINT64 Operand, IN UINTN Count ) /* Left shift 64bit by 32bit and get a 64bit result */ { return Operand << Count; }
UINT64 RShiftU64 ( IN UINT64 Operand, IN UINTN Count ) /* Right shift 64bit by 32bit and get a 64bit result */ { return Operand >> Count; }
UINT64 MultU64x32 ( IN UINT64 Multiplicand, IN UINTN Multiplier ) /* Multiple 64bit by 32bit and get a 64bit result */ { return Multiplicand * Multiplier; }
UINT64 DivU64x32 ( IN UINT64 Dividend, IN UINTN Divisor, OUT UINTN *Remainder OPTIONAL ) /* divide 64bit by 32bit and get a 64bit result
* N.B. only works for 31bit divisors!! */ { ASSERT (Divisor != 0);
if (Remainder) { *Remainder = Dividend % Divisor; }
return Dividend / Divisor; }
|