Coverage Report

Created: 2026-03-13 19:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/util/simd/reverse_copy_bytes.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/data_type/data_type.h"
21
22
namespace doris::simd {
23
#include "common/compile_check_begin.h"
24
// Copy src_len bytes from src_void to desc in reverse order.
25
// The first bytes of src_void will be copied to the last bytes of desc.
26
inline void reverse_copy_bytes(UInt8* __restrict desc, size_t desc_len, const void* src_void,
27
491k
                               size_t src_len) {
28
491k
    if (src_len == 0) {
29
114k
        return;
30
114k
    }
31
32
377k
    const UInt8* __restrict src_ui8 = static_cast<const UInt8*>(src_void);
33
34
1.45M
    for (int64_t i = desc_len - 1, j = 0; j < src_len; --i, ++j) {
35
1.07M
        desc[i] = src_ui8[j];
36
1.07M
    }
37
377k
}
38
#include "common/compile_check_end.h"
39
} // namespace doris::simd