Coverage Report

Created: 2026-04-10 16:11

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exec/common/endian.h
Line
Count
Source
1
// Licensed to the Apache Software Foundation (ASF) under one
2
// or more contributor license agreements.  See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership.  The ASF licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License.  You may obtain a copy of the License at
8
//
9
//   http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied.  See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
#pragma once
19
20
#include "core/extended_types.h"
21
#include "core/uint24.h"
22
#include "util/unaligned.h"
23
24
namespace doris {
25
8.19k
inline uint64_t gbswap_64(uint64_t host_int) {
26
8.19k
#if defined(__GNUC__) && defined(__x86_64__) && !defined(__APPLE__)
27
    // Adapted from /usr/include/byteswap.h.  Not available on Mac.
28
8.19k
    if (__builtin_constant_p(host_int)) {
29
0
        return __bswap_constant_64(host_int);
30
8.19k
    } else {
31
8.19k
        uint64_t result;
32
8.19k
        __asm__("bswap %0" : "=r"(result) : "0"(host_int));
33
8.19k
        return result;
34
8.19k
    }
35
#elif defined(bswap_64)
36
    return bswap_64(host_int);
37
#else
38
    return static_cast<uint64_t>(bswap_32(static_cast<uint32_t>(host_int >> 32))) |
39
           (static_cast<uint64_t>(bswap_32(static_cast<uint32_t>(host_int))) << 32);
40
#endif // bswap_64
41
8.19k
}
42
43
7.56M
inline unsigned __int128 gbswap_128(unsigned __int128 host_int) {
44
7.56M
    return static_cast<unsigned __int128>(bswap_64(static_cast<uint64_t>(host_int >> 64))) |
45
7.56M
           (static_cast<unsigned __int128>(bswap_64(static_cast<uint64_t>(host_int))) << 64);
46
7.56M
}
47
48
2.04k
inline wide::UInt256 gbswap_256(wide::UInt256 host_int) {
49
2.04k
    wide::UInt256 result {gbswap_64(host_int.items[3]), gbswap_64(host_int.items[2]),
50
2.04k
                          gbswap_64(host_int.items[1]), gbswap_64(host_int.items[0])};
51
2.04k
    return result;
52
2.04k
}
53
54
// Swap bytes of a 24-bit value.
55
401k
inline uint32_t bswap_24(uint32_t x) {
56
401k
    return uint32_t((x & 0x0000ffULL) << 16) | ((x & 0x00ff00ULL)) | ((x & 0xff0000ULL) >> 16);
57
401k
}
58
59
// use std::byteswap after doris enable cpp23
60
template <typename T>
61
50.9M
T byte_swap(T x) {
62
50.9M
    if constexpr (sizeof(T) == sizeof(wide::Int256)) {
63
2.04k
        return gbswap_256(x);
64
7.56M
    } else if constexpr (sizeof(T) == sizeof(__int128)) {
65
7.56M
        return gbswap_128(x);
66
16.7M
    } else if constexpr (sizeof(T) == sizeof(int64_t)) {
67
16.7M
        return bswap_64(x);
68
24.2M
    } else if constexpr (sizeof(T) == sizeof(int32_t)) {
69
24.2M
        return bswap_32(x);
70
24.2M
    } else if constexpr (sizeof(T) == sizeof(doris::uint24_t)) {
71
402k
        return bswap_24(x);
72
608k
    } else if constexpr (sizeof(T) == sizeof(int16_t)) {
73
608k
        return bswap_16(x);
74
1.32M
    } else {
75
1.32M
        static_assert(sizeof(T) == 1, "Unsupported type size for byte_swap");
76
1.32M
        return x; // No byte swap needed for unsupported types
77
1.32M
    }
78
50.9M
}
_ZN5doris9byte_swapItEET_S1_
Line
Count
Source
61
608k
T byte_swap(T x) {
62
    if constexpr (sizeof(T) == sizeof(wide::Int256)) {
63
        return gbswap_256(x);
64
    } else if constexpr (sizeof(T) == sizeof(__int128)) {
65
        return gbswap_128(x);
66
    } else if constexpr (sizeof(T) == sizeof(int64_t)) {
67
        return bswap_64(x);
68
    } else if constexpr (sizeof(T) == sizeof(int32_t)) {
69
        return bswap_32(x);
70
    } else if constexpr (sizeof(T) == sizeof(doris::uint24_t)) {
71
        return bswap_24(x);
72
608k
    } else if constexpr (sizeof(T) == sizeof(int16_t)) {
73
608k
        return bswap_16(x);
74
    } else {
75
        static_assert(sizeof(T) == 1, "Unsupported type size for byte_swap");
76
        return x; // No byte swap needed for unsupported types
77
    }
78
608k
}
_ZN5doris9byte_swapIjEET_S1_
Line
Count
Source
61
24.2M
T byte_swap(T x) {
62
    if constexpr (sizeof(T) == sizeof(wide::Int256)) {
63
        return gbswap_256(x);
64
    } else if constexpr (sizeof(T) == sizeof(__int128)) {
65
        return gbswap_128(x);
66
    } else if constexpr (sizeof(T) == sizeof(int64_t)) {
67
        return bswap_64(x);
68
24.2M
    } else if constexpr (sizeof(T) == sizeof(int32_t)) {
69
24.2M
        return bswap_32(x);
70
    } else if constexpr (sizeof(T) == sizeof(doris::uint24_t)) {
71
        return bswap_24(x);
72
    } else if constexpr (sizeof(T) == sizeof(int16_t)) {
73
        return bswap_16(x);
74
    } else {
75
        static_assert(sizeof(T) == 1, "Unsupported type size for byte_swap");
76
        return x; // No byte swap needed for unsupported types
77
    }
78
24.2M
}
_ZN5doris9byte_swapImEET_S1_
Line
Count
Source
61
15.3M
T byte_swap(T x) {
62
    if constexpr (sizeof(T) == sizeof(wide::Int256)) {
63
        return gbswap_256(x);
64
    } else if constexpr (sizeof(T) == sizeof(__int128)) {
65
        return gbswap_128(x);
66
15.3M
    } else if constexpr (sizeof(T) == sizeof(int64_t)) {
67
15.3M
        return bswap_64(x);
68
    } else if constexpr (sizeof(T) == sizeof(int32_t)) {
69
        return bswap_32(x);
70
    } else if constexpr (sizeof(T) == sizeof(doris::uint24_t)) {
71
        return bswap_24(x);
72
    } else if constexpr (sizeof(T) == sizeof(int16_t)) {
73
        return bswap_16(x);
74
    } else {
75
        static_assert(sizeof(T) == 1, "Unsupported type size for byte_swap");
76
        return x; // No byte swap needed for unsupported types
77
    }
78
15.3M
}
_ZN5doris9byte_swapINS_8uint24_tEEET_S2_
Line
Count
Source
61
402k
T byte_swap(T x) {
62
    if constexpr (sizeof(T) == sizeof(wide::Int256)) {
63
        return gbswap_256(x);
64
    } else if constexpr (sizeof(T) == sizeof(__int128)) {
65
        return gbswap_128(x);
66
    } else if constexpr (sizeof(T) == sizeof(int64_t)) {
67
        return bswap_64(x);
68
    } else if constexpr (sizeof(T) == sizeof(int32_t)) {
69
        return bswap_32(x);
70
402k
    } else if constexpr (sizeof(T) == sizeof(doris::uint24_t)) {
71
402k
        return bswap_24(x);
72
    } else if constexpr (sizeof(T) == sizeof(int16_t)) {
73
        return bswap_16(x);
74
    } else {
75
        static_assert(sizeof(T) == 1, "Unsupported type size for byte_swap");
76
        return x; // No byte swap needed for unsupported types
77
    }
78
402k
}
_ZN5doris9byte_swapIhEET_S1_
Line
Count
Source
61
1.32M
T byte_swap(T x) {
62
    if constexpr (sizeof(T) == sizeof(wide::Int256)) {
63
        return gbswap_256(x);
64
    } else if constexpr (sizeof(T) == sizeof(__int128)) {
65
        return gbswap_128(x);
66
    } else if constexpr (sizeof(T) == sizeof(int64_t)) {
67
        return bswap_64(x);
68
    } else if constexpr (sizeof(T) == sizeof(int32_t)) {
69
        return bswap_32(x);
70
    } else if constexpr (sizeof(T) == sizeof(doris::uint24_t)) {
71
        return bswap_24(x);
72
    } else if constexpr (sizeof(T) == sizeof(int16_t)) {
73
        return bswap_16(x);
74
1.32M
    } else {
75
1.32M
        static_assert(sizeof(T) == 1, "Unsupported type size for byte_swap");
76
1.32M
        return x; // No byte swap needed for unsupported types
77
1.32M
    }
78
1.32M
}
_ZN5doris9byte_swapIoEET_S1_
Line
Count
Source
61
2.16M
T byte_swap(T x) {
62
    if constexpr (sizeof(T) == sizeof(wide::Int256)) {
63
        return gbswap_256(x);
64
2.16M
    } else if constexpr (sizeof(T) == sizeof(__int128)) {
65
2.16M
        return gbswap_128(x);
66
    } else if constexpr (sizeof(T) == sizeof(int64_t)) {
67
        return bswap_64(x);
68
    } else if constexpr (sizeof(T) == sizeof(int32_t)) {
69
        return bswap_32(x);
70
    } else if constexpr (sizeof(T) == sizeof(doris::uint24_t)) {
71
        return bswap_24(x);
72
    } else if constexpr (sizeof(T) == sizeof(int16_t)) {
73
        return bswap_16(x);
74
    } else {
75
        static_assert(sizeof(T) == 1, "Unsupported type size for byte_swap");
76
        return x; // No byte swap needed for unsupported types
77
    }
78
2.16M
}
_ZN5doris9byte_swapIN4wide7integerILm256EjEEEET_S4_
Line
Count
Source
61
2.02k
T byte_swap(T x) {
62
2.02k
    if constexpr (sizeof(T) == sizeof(wide::Int256)) {
63
2.02k
        return gbswap_256(x);
64
    } else if constexpr (sizeof(T) == sizeof(__int128)) {
65
        return gbswap_128(x);
66
    } else if constexpr (sizeof(T) == sizeof(int64_t)) {
67
        return bswap_64(x);
68
    } else if constexpr (sizeof(T) == sizeof(int32_t)) {
69
        return bswap_32(x);
70
    } else if constexpr (sizeof(T) == sizeof(doris::uint24_t)) {
71
        return bswap_24(x);
72
    } else if constexpr (sizeof(T) == sizeof(int16_t)) {
73
        return bswap_16(x);
74
    } else {
75
        static_assert(sizeof(T) == 1, "Unsupported type size for byte_swap");
76
        return x; // No byte swap needed for unsupported types
77
    }
78
2.02k
}
_ZN5doris9byte_swapIlEET_S1_
Line
Count
Source
61
1.44M
T byte_swap(T x) {
62
    if constexpr (sizeof(T) == sizeof(wide::Int256)) {
63
        return gbswap_256(x);
64
    } else if constexpr (sizeof(T) == sizeof(__int128)) {
65
        return gbswap_128(x);
66
1.44M
    } else if constexpr (sizeof(T) == sizeof(int64_t)) {
67
1.44M
        return bswap_64(x);
68
    } else if constexpr (sizeof(T) == sizeof(int32_t)) {
69
        return bswap_32(x);
70
    } else if constexpr (sizeof(T) == sizeof(doris::uint24_t)) {
71
        return bswap_24(x);
72
    } else if constexpr (sizeof(T) == sizeof(int16_t)) {
73
        return bswap_16(x);
74
    } else {
75
        static_assert(sizeof(T) == 1, "Unsupported type size for byte_swap");
76
        return x; // No byte swap needed for unsupported types
77
    }
78
1.44M
}
_ZN5doris9byte_swapInEET_S1_
Line
Count
Source
61
5.39M
T byte_swap(T x) {
62
    if constexpr (sizeof(T) == sizeof(wide::Int256)) {
63
        return gbswap_256(x);
64
5.39M
    } else if constexpr (sizeof(T) == sizeof(__int128)) {
65
5.39M
        return gbswap_128(x);
66
    } else if constexpr (sizeof(T) == sizeof(int64_t)) {
67
        return bswap_64(x);
68
    } else if constexpr (sizeof(T) == sizeof(int32_t)) {
69
        return bswap_32(x);
70
    } else if constexpr (sizeof(T) == sizeof(doris::uint24_t)) {
71
        return bswap_24(x);
72
    } else if constexpr (sizeof(T) == sizeof(int16_t)) {
73
        return bswap_16(x);
74
    } else {
75
        static_assert(sizeof(T) == 1, "Unsupported type size for byte_swap");
76
        return x; // No byte swap needed for unsupported types
77
    }
78
5.39M
}
_ZN5doris9byte_swapIN4wide7integerILm256EiEEEET_S4_
Line
Count
Source
61
20
T byte_swap(T x) {
62
20
    if constexpr (sizeof(T) == sizeof(wide::Int256)) {
63
20
        return gbswap_256(x);
64
    } else if constexpr (sizeof(T) == sizeof(__int128)) {
65
        return gbswap_128(x);
66
    } else if constexpr (sizeof(T) == sizeof(int64_t)) {
67
        return bswap_64(x);
68
    } else if constexpr (sizeof(T) == sizeof(int32_t)) {
69
        return bswap_32(x);
70
    } else if constexpr (sizeof(T) == sizeof(doris::uint24_t)) {
71
        return bswap_24(x);
72
    } else if constexpr (sizeof(T) == sizeof(int16_t)) {
73
        return bswap_16(x);
74
    } else {
75
        static_assert(sizeof(T) == 1, "Unsupported type size for byte_swap");
76
        return x; // No byte swap needed for unsupported types
77
    }
78
20
}
_ZN5doris9byte_swapIiEET_S1_
Line
Count
Source
61
56
T byte_swap(T x) {
62
    if constexpr (sizeof(T) == sizeof(wide::Int256)) {
63
        return gbswap_256(x);
64
    } else if constexpr (sizeof(T) == sizeof(__int128)) {
65
        return gbswap_128(x);
66
    } else if constexpr (sizeof(T) == sizeof(int64_t)) {
67
        return bswap_64(x);
68
56
    } else if constexpr (sizeof(T) == sizeof(int32_t)) {
69
56
        return bswap_32(x);
70
    } else if constexpr (sizeof(T) == sizeof(doris::uint24_t)) {
71
        return bswap_24(x);
72
    } else if constexpr (sizeof(T) == sizeof(int16_t)) {
73
        return bswap_16(x);
74
    } else {
75
        static_assert(sizeof(T) == 1, "Unsupported type size for byte_swap");
76
        return x; // No byte swap needed for unsupported types
77
    }
78
56
}
79
80
template <std::endian target, typename T>
81
335M
T to_endian(T value) {
82
335M
    if constexpr (std::endian::native == target) {
83
284M
        return value; // No swap needed
84
284M
    } else {
85
50.9M
        static_assert(std::endian::native == std::endian::big ||
86
50.9M
                              std::endian::native == std::endian::little,
87
50.9M
                      "Unsupported endianness");
88
50.9M
        return byte_swap(value);
89
50.9M
    }
90
335M
}
_ZN5doris9to_endianILSt6endian1234EtEET0_S2_
Line
Count
Source
81
433k
T to_endian(T value) {
82
433k
    if constexpr (std::endian::native == target) {
83
433k
        return value; // No swap needed
84
    } else {
85
        static_assert(std::endian::native == std::endian::big ||
86
                              std::endian::native == std::endian::little,
87
                      "Unsupported endianness");
88
        return byte_swap(value);
89
    }
90
433k
}
_ZN5doris9to_endianILSt6endian1234EjEET0_S2_
Line
Count
Source
81
280M
T to_endian(T value) {
82
280M
    if constexpr (std::endian::native == target) {
83
280M
        return value; // No swap needed
84
    } else {
85
        static_assert(std::endian::native == std::endian::big ||
86
                              std::endian::native == std::endian::little,
87
                      "Unsupported endianness");
88
        return byte_swap(value);
89
    }
90
280M
}
_ZN5doris9to_endianILSt6endian1234EmEET0_S2_
Line
Count
Source
81
3.32M
T to_endian(T value) {
82
3.32M
    if constexpr (std::endian::native == target) {
83
3.32M
        return value; // No swap needed
84
    } else {
85
        static_assert(std::endian::native == std::endian::big ||
86
                              std::endian::native == std::endian::little,
87
                      "Unsupported endianness");
88
        return byte_swap(value);
89
    }
90
3.32M
}
_ZN5doris9to_endianILSt6endian4321EtEET0_S2_
Line
Count
Source
81
608k
T to_endian(T value) {
82
    if constexpr (std::endian::native == target) {
83
        return value; // No swap needed
84
608k
    } else {
85
608k
        static_assert(std::endian::native == std::endian::big ||
86
608k
                              std::endian::native == std::endian::little,
87
608k
                      "Unsupported endianness");
88
608k
        return byte_swap(value);
89
608k
    }
90
608k
}
_ZN5doris9to_endianILSt6endian4321EjEET0_S2_
Line
Count
Source
81
24.2M
T to_endian(T value) {
82
    if constexpr (std::endian::native == target) {
83
        return value; // No swap needed
84
24.2M
    } else {
85
24.2M
        static_assert(std::endian::native == std::endian::big ||
86
24.2M
                              std::endian::native == std::endian::little,
87
24.2M
                      "Unsupported endianness");
88
24.2M
        return byte_swap(value);
89
24.2M
    }
90
24.2M
}
_ZN5doris9to_endianILSt6endian4321EmEET0_S2_
Line
Count
Source
81
15.3M
T to_endian(T value) {
82
    if constexpr (std::endian::native == target) {
83
        return value; // No swap needed
84
15.3M
    } else {
85
15.3M
        static_assert(std::endian::native == std::endian::big ||
86
15.3M
                              std::endian::native == std::endian::little,
87
15.3M
                      "Unsupported endianness");
88
15.3M
        return byte_swap(value);
89
15.3M
    }
90
15.3M
}
_ZN5doris9to_endianILSt6endian1234EoEET0_S2_
Line
Count
Source
81
48.8k
T to_endian(T value) {
82
48.8k
    if constexpr (std::endian::native == target) {
83
48.8k
        return value; // No swap needed
84
    } else {
85
        static_assert(std::endian::native == std::endian::big ||
86
                              std::endian::native == std::endian::little,
87
                      "Unsupported endianness");
88
        return byte_swap(value);
89
    }
90
48.8k
}
_ZN5doris9to_endianILSt6endian4321ENS_8uint24_tEEET0_S3_
Line
Count
Source
81
402k
T to_endian(T value) {
82
    if constexpr (std::endian::native == target) {
83
        return value; // No swap needed
84
402k
    } else {
85
402k
        static_assert(std::endian::native == std::endian::big ||
86
402k
                              std::endian::native == std::endian::little,
87
402k
                      "Unsupported endianness");
88
402k
        return byte_swap(value);
89
402k
    }
90
402k
}
_ZN5doris9to_endianILSt6endian4321EhEET0_S2_
Line
Count
Source
81
1.33M
T to_endian(T value) {
82
    if constexpr (std::endian::native == target) {
83
        return value; // No swap needed
84
1.33M
    } else {
85
1.33M
        static_assert(std::endian::native == std::endian::big ||
86
1.33M
                              std::endian::native == std::endian::little,
87
1.33M
                      "Unsupported endianness");
88
1.33M
        return byte_swap(value);
89
1.33M
    }
90
1.33M
}
_ZN5doris9to_endianILSt6endian4321EoEET0_S2_
Line
Count
Source
81
2.16M
T to_endian(T value) {
82
    if constexpr (std::endian::native == target) {
83
        return value; // No swap needed
84
2.16M
    } else {
85
2.16M
        static_assert(std::endian::native == std::endian::big ||
86
2.16M
                              std::endian::native == std::endian::little,
87
2.16M
                      "Unsupported endianness");
88
2.16M
        return byte_swap(value);
89
2.16M
    }
90
2.16M
}
_ZN5doris9to_endianILSt6endian4321EN4wide7integerILm256EjEEEET0_S5_
Line
Count
Source
81
2.02k
T to_endian(T value) {
82
    if constexpr (std::endian::native == target) {
83
        return value; // No swap needed
84
2.02k
    } else {
85
2.02k
        static_assert(std::endian::native == std::endian::big ||
86
2.02k
                              std::endian::native == std::endian::little,
87
2.02k
                      "Unsupported endianness");
88
2.02k
        return byte_swap(value);
89
2.02k
    }
90
2.02k
}
_ZN5doris9to_endianILSt6endian4321ElEET0_S2_
Line
Count
Source
81
1.44M
T to_endian(T value) {
82
    if constexpr (std::endian::native == target) {
83
        return value; // No swap needed
84
1.44M
    } else {
85
1.44M
        static_assert(std::endian::native == std::endian::big ||
86
1.44M
                              std::endian::native == std::endian::little,
87
1.44M
                      "Unsupported endianness");
88
1.44M
        return byte_swap(value);
89
1.44M
    }
90
1.44M
}
_ZN5doris9to_endianILSt6endian4321EnEET0_S2_
Line
Count
Source
81
5.39M
T to_endian(T value) {
82
    if constexpr (std::endian::native == target) {
83
        return value; // No swap needed
84
5.39M
    } else {
85
5.39M
        static_assert(std::endian::native == std::endian::big ||
86
5.39M
                              std::endian::native == std::endian::little,
87
5.39M
                      "Unsupported endianness");
88
5.39M
        return byte_swap(value);
89
5.39M
    }
90
5.39M
}
_ZN5doris9to_endianILSt6endian4321EN4wide7integerILm256EiEEEET0_S5_
Line
Count
Source
81
20
T to_endian(T value) {
82
    if constexpr (std::endian::native == target) {
83
        return value; // No swap needed
84
20
    } else {
85
20
        static_assert(std::endian::native == std::endian::big ||
86
20
                              std::endian::native == std::endian::little,
87
20
                      "Unsupported endianness");
88
20
        return byte_swap(value);
89
20
    }
90
20
}
_ZN5doris9to_endianILSt6endian4321EiEET0_S2_
Line
Count
Source
81
56
T to_endian(T value) {
82
    if constexpr (std::endian::native == target) {
83
        return value; // No swap needed
84
56
    } else {
85
56
        static_assert(std::endian::native == std::endian::big ||
86
56
                              std::endian::native == std::endian::little,
87
56
                      "Unsupported endianness");
88
56
        return byte_swap(value);
89
56
    }
90
56
}
91
92
// Utilities to convert numbers between the current hosts's native byte
93
// order and little-endian byte order
94
//
95
// Load/Store methods are alignment safe
96
class LittleEndian {
97
public:
98
    // Functions to do unaligned loads and stores in little-endian order.
99
0
    static uint16_t Load16(const void* p) {
100
0
        return to_endian<std::endian::little>(unaligned_load<uint16_t>(p));
101
0
    }
102
103
0
    static void Store16(void* p, uint16_t v) {
104
0
        unaligned_store<uint16_t>(p, to_endian<std::endian::little>(v));
105
0
    }
106
107
17.4M
    static uint32_t Load32(const void* p) {
108
17.4M
        return to_endian<std::endian::little>(unaligned_load<uint32_t>(p));
109
17.4M
    }
110
111
29
    static void Store32(void* p, uint32_t v) {
112
29
        unaligned_store<uint32_t>(p, to_endian<std::endian::little>(v));
113
29
    }
114
115
3.06M
    static uint64_t Load64(const void* p) {
116
3.06M
        return to_endian<std::endian::little>(unaligned_load<uint64_t>(p));
117
3.06M
    }
118
119
0
    static void Store64(void* p, uint64_t v) {
120
0
        unaligned_store<uint64_t>(p, to_endian<std::endian::little>(v));
121
0
    }
122
};
123
124
// Utilities to convert numbers between the current hosts's native byte
125
// order and big-endian byte order (same as network byte order)
126
//
127
// Load/Store methods are alignment safe
128
class BigEndian {
129
public:
130
    // Functions to do unaligned loads and stores in little-endian order.
131
0
    static uint16_t Load16(const void* p) {
132
0
        return to_endian<std::endian::big>(unaligned_load<uint16_t>(p));
133
0
    }
134
135
0
    static void Store16(void* p, uint16_t v) {
136
0
        unaligned_store<uint16_t>(p, to_endian<std::endian::big>(v));
137
0
    }
138
139
15.1k
    static uint32_t Load32(const void* p) {
140
15.1k
        return to_endian<std::endian::big>(unaligned_load<uint32_t>(p));
141
15.1k
    }
142
143
1.24k
    static void Store32(void* p, uint32_t v) {
144
1.24k
        unaligned_store<uint32_t>(p, to_endian<std::endian::big>(v));
145
1.24k
    }
146
147
0
    static uint64_t Load64(const void* p) {
148
0
        return to_endian<std::endian::big>(unaligned_load<uint64_t>(p));
149
0
    }
150
151
0
    static void Store64(void* p, uint64_t v) {
152
0
        unaligned_store<uint64_t>(p, to_endian<std::endian::big>(v));
153
0
    }
154
}; // BigEndian
155
} // namespace doris