/** @file\r
Integer division worker functions for Ia32.\r
\r
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
INT64 Quot;\r
\r
Quot = InternalMathDivRemU64x64 (\r
- Dividend >= 0 ? Dividend : -Dividend,\r
- Divisor >= 0 ? Divisor : -Divisor,\r
+ (UINT64) (Dividend >= 0 ? Dividend : -Dividend),\r
+ (UINT64) (Divisor >= 0 ? Divisor : -Divisor),\r
(UINT64 *) Remainder\r
);\r
if (Remainder != NULL && Dividend < 0) {\r
\r
#include "BaseLibInternals.h"\r
\r
-#define QUOTIENT_MAX_UINTN_DIVIDED_BY_10 ((UINTN) -1 / 10U)\r
-#define REMAINDER_MAX_UINTN_DIVIDED_BY_10 ((UINTN) -1 % 10U)\r
+#define QUOTIENT_MAX_UINTN_DIVIDED_BY_10 ((~((UINTN) 0)) / 10U)\r
+#define REMAINDER_MAX_UINTN_DIVIDED_BY_10 ((~((UINTN) 0)) % 10U)\r
\r
-#define QUOTIENT_MAX_UINTN_DIVIDED_BY_16 ((UINTN) -1 / 16U)\r
-#define REMAINDER_MAX_UINTN_DIVIDED_BY_16 ((UINTN) -1 % 16U)\r
\r
-#define QUOTIENT_MAX_UINT64_DIVIDED_BY_10 ((UINT64) -1 / 10U)\r
-#define REMAINDER_MAX_UINT64_DIVIDED_BY_10 ((UINT64) -1 % 10U)\r
+#define QUOTIENT_MAX_UINTN_DIVIDED_BY_16 ((~((UINTN) 0)) / 16U)\r
+#define REMAINDER_MAX_UINTN_DIVIDED_BY_16 ((~((UINTN) 0)) % 16U)\r
\r
-#define QUOTIENT_MAX_UINT64_DIVIDED_BY_16 ((UINT64) -1 / 16U)\r
-#define REMAINDER_MAX_UINT64_DIVIDED_BY_16 ((UINT64) -1 % 16U)\r
+#define QUOTIENT_MAX_UINT64_DIVIDED_BY_10 ((~((UINT64) 0)) / 10U)\r
+#define REMAINDER_MAX_UINT64_DIVIDED_BY_10 ((~((UINT64) 0)) % 10U)\r
+\r
+#define QUOTIENT_MAX_UINT64_DIVIDED_BY_16 ((~((UINT64) 0)) / 16U)\r
+#define REMAINDER_MAX_UINT64_DIVIDED_BY_16 ((~((UINT64) 0)) % 16U)\r
\r
/**\r
Copies one Null-terminated Unicode string to another Null-terminated Unicode\r
ASSERT (((MemoryAllocationModule & (EFI_PAGE_SIZE - 1)) == 0) &&\r
((ModuleLength & (EFI_PAGE_SIZE - 1)) == 0));\r
\r
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION_MODULE));\r
+ Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_MODULE));\r
\r
CopyGuid (&(Hob->MemoryAllocationHeader.Name), &gEfiHobMemoryAllocModuleGuid);\r
Hob->MemoryAllocationHeader.MemoryBaseAddress = MemoryAllocationModule;\r
{\r
EFI_HOB_RESOURCE_DESCRIPTOR *Hob;\r
\r
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, sizeof (EFI_HOB_RESOURCE_DESCRIPTOR));\r
+ Hob = InternalPeiCreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, (UINT16) sizeof (EFI_HOB_RESOURCE_DESCRIPTOR));\r
\r
Hob->ResourceType = ResourceType;\r
Hob->ResourceAttribute = ResourceAttribute;\r
{\r
EFI_HOB_FIRMWARE_VOLUME *Hob;\r
\r
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV, sizeof (EFI_HOB_FIRMWARE_VOLUME));\r
+ Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME));\r
\r
Hob->BaseAddress = BaseAddress;\r
Hob->Length = Length;\r
{\r
EFI_HOB_FIRMWARE_VOLUME2 *Hob;\r
\r
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV2, sizeof (EFI_HOB_FIRMWARE_VOLUME2));\r
+ Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV2, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME2));\r
\r
Hob->BaseAddress = BaseAddress;\r
Hob->Length = Length;\r
{\r
EFI_HOB_UEFI_CAPSULE *Hob;\r
\r
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_UEFI_CAPSULE, sizeof (EFI_HOB_UEFI_CAPSULE));\r
+ Hob = InternalPeiCreateHob (EFI_HOB_TYPE_UEFI_CAPSULE, (UINT16) sizeof (EFI_HOB_UEFI_CAPSULE));\r
\r
Hob->BaseAddress = BaseAddress;\r
Hob->Length = Length;\r
{\r
EFI_HOB_CPU *Hob;\r
\r
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_CPU, sizeof (EFI_HOB_CPU));\r
+ Hob = InternalPeiCreateHob (EFI_HOB_TYPE_CPU, (UINT16) sizeof (EFI_HOB_CPU));\r
\r
Hob->SizeOfMemorySpace = SizeOfMemorySpace;\r
Hob->SizeOfIoSpace = SizeOfIoSpace;\r
ASSERT (((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) &&\r
((Length & (EFI_PAGE_SIZE - 1)) == 0));\r
\r
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION_STACK));\r
+ Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_STACK));\r
\r
CopyGuid (&(Hob->AllocDescriptor.Name), &gEfiHobMemoryAllocStackGuid);\r
Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;\r
ASSERT (((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) &&\r
((Length & (EFI_PAGE_SIZE - 1)) == 0));\r
\r
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION_BSP_STORE));\r
+ Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_BSP_STORE));\r
\r
CopyGuid (&(Hob->AllocDescriptor.Name), &gEfiHobMemoryAllocBspStoreGuid);\r
Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;\r
ASSERT (((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) &&\r
((Length & (EFI_PAGE_SIZE - 1)) == 0));\r
\r
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION));\r
+ Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION));\r
\r
ZeroMem (&(Hob->AllocDescriptor.Name), sizeof (EFI_GUID));\r
Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;\r