Skip to content

Commit 0a47352

Browse files
[libc][uefi] use cpp::numeric_limits for UEFI_STATUS_ERRNO_MAP
1 parent f87345a commit 0a47352

File tree

1 file changed

+4
-4
lines changed
  • libc/src/__support/OSUtil/uefi

1 file changed

+4
-4
lines changed

libc/src/__support/OSUtil/uefi/error.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
#ifndef LLVM_LIBC_SRC___SUPPORT_OSUTIL_UEFI_ERROR_H
1010
#define LLVM_LIBC_SRC___SUPPORT_OSUTIL_UEFI_ERROR_H
1111

12+
#include "hdr/errno_macros.h"
1213
#include "include/llvm-libc-types/EFI_STATUS.h"
1314
#include "src/__support/CPP/array.h"
15+
#include "src/__support/CPP/limits.h"
1416
#include "src/__support/macros/attributes.h"
1517
#include "src/__support/macros/config.h"
16-
#include <errno.h>
17-
#include <limits.h>
1818

1919
namespace LIBC_NAMESPACE_DECL {
2020

21-
#define EFI_ERROR_MAX_BIT (1 << (sizeof(EFI_STATUS) * sizeof(char) - 1))
21+
#define EFI_ERROR_MAX_BIT (cpp::numeric_limits<EFI_STATUS>::max())
2222
#define EFI_ENCODE_ERROR(value) \
2323
(EFI_ERROR_MAX_BIT | (EFI_ERROR_MAX_BIT >> 2) | (value))
2424
#define EFI_ENCODE_WARNING(value) ((EFI_ERROR_MAX_BIT >> 2) | (value))
@@ -28,7 +28,7 @@ struct UefiStatusErrnoEntry {
2828
int errno_value;
2929
};
3030

31-
static constexpr cpp::array<UefiStatusErrnoEntry, 43> UEFI_STATUS_ERRNO_MAP = {{
31+
static const cpp::array<UefiStatusErrnoEntry, 43> UEFI_STATUS_ERRNO_MAP = {{
3232
{EFI_SUCCESS, 0},
3333
{EFI_ENCODE_ERROR(EFI_LOAD_ERROR), EINVAL},
3434
{EFI_ENCODE_ERROR(EFI_INVALID_PARAMETER), EINVAL},

0 commit comments

Comments
 (0)