summaryrefslogtreecommitdiff
path: root/www-client/chromium/files/chromium-100-ByteSwapUintPtrT-constexpr.patch
blob: dc85dc2b07ea0c00345cabeb77abe793e4651bd3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
From 1ea2079fec7098cd0fdfabce259d65a09197532d Mon Sep 17 00:00:00 2001
From: Stephan Hartmann <stha09@googlemail.com>
Date: Thu, 27 Jan 2022 14:36:21 +0000
Subject: [PATCH] GCC: add constexpr to base::ByteSwapUintPtrT and
 base::ByteSwap

base::internal::EncodedPartitionFreelistEntryPtr::Transform() is
constexpr. This requires base::ByteSwapUintPtrT() and
base::ByteSwap() to be constexpr too.
---
 base/sys_byteorder.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/base/sys_byteorder.h b/base/sys_byteorder.h
index 4de2b5f..d86cc36 100644
--- a/base/sys_byteorder.h
+++ b/base/sys_byteorder.h
@@ -22,7 +22,7 @@
 namespace base {
 
 // Returns a value with all bytes in |x| swapped, i.e. reverses the endianness.
-inline uint16_t ByteSwap(uint16_t x) {
+constexpr uint16_t ByteSwap(uint16_t x) {
 #if defined(COMPILER_MSVC) && !defined(__clang__)
   return _byteswap_ushort(x);
 #else
@@ -30,7 +30,7 @@ inline uint16_t ByteSwap(uint16_t x) {
 #endif
 }
 
-inline uint32_t ByteSwap(uint32_t x) {
+constexpr uint32_t ByteSwap(uint32_t x) {
 #if defined(COMPILER_MSVC) && !defined(__clang__)
   return _byteswap_ulong(x);
 #else
@@ -38,7 +38,7 @@ inline uint32_t ByteSwap(uint32_t x) {
 #endif
 }
 
-inline uint64_t ByteSwap(uint64_t x) {
+constexpr uint64_t ByteSwap(uint64_t x) {
   // Per build/build_config.h, clang masquerades as MSVC on Windows. If we are
   // actually using clang, we can rely on the builtin.
   //
@@ -53,7 +53,7 @@ inline uint64_t ByteSwap(uint64_t x) {
 #endif
 }
 
-inline uintptr_t ByteSwapUintPtrT(uintptr_t x) {
+constexpr uintptr_t ByteSwapUintPtrT(uintptr_t x) {
   // We do it this way because some build configurations are ILP32 even when
   // defined(ARCH_CPU_64_BITS). Unfortunately, we can't use sizeof in #ifs. But,
   // because these conditionals are constexprs, the irrelevant branches will
-- 
2.34.1