Skip to content

Commit 8ba4b1b

Browse files
committed
remove array util inline
1 parent 4793946 commit 8ba4b1b

File tree

2 files changed

+34
-6
lines changed

2 files changed

+34
-6
lines changed

cpp/fury/util/array_util.cc

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
#pragma once
21+
#include "fury/util/platform.h"
22+
#include <cstdint>
23+
24+
namespace fury {
25+
uint16_t getMaxValue(const uint16_t *arr, size_t length);
26+
27+
void copyArray(const uint16_t *from, uint8_t *to, size_t length);
28+
} // namespace fury

cpp/fury/util/array_util.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
namespace fury {
2525
#if defined(FURY_HAS_NEON)
26-
inline uint16_t getMaxValue(const uint16_t *arr, size_t length) {
26+
uint16_t getMaxValue(const uint16_t *arr, size_t length) {
2727
if (length == 0) {
2828
return 0; // Return 0 for empty arrays
2929
}
@@ -54,7 +54,7 @@ inline uint16_t getMaxValue(const uint16_t *arr, size_t length) {
5454
return max_neon;
5555
}
5656

57-
inline void copyArray(const uint16_t *from, uint8_t *to, size_t length) {
57+
void copyArray(const uint16_t *from, uint8_t *to, size_t length) {
5858
size_t i = 0;
5959
for (; i + 7 < length; i += 8) {
6060
uint16x8_t src = vld1q_u16(&from[i]);
@@ -68,7 +68,7 @@ inline void copyArray(const uint16_t *from, uint8_t *to, size_t length) {
6868
}
6969
}
7070
#elif defined(FURY_HAS_SSE2)
71-
inline uint16_t getMaxValue(const uint16_t *arr, size_t length) {
71+
uint16_t getMaxValue(const uint16_t *arr, size_t length) {
7272
if (length == 0) {
7373
return 0; // Return 0 for empty arrays
7474
}
@@ -100,7 +100,7 @@ inline uint16_t getMaxValue(const uint16_t *arr, size_t length) {
100100
return max_sse;
101101
}
102102

103-
inline void copyArray(const uint16_t *from, uint8_t *to, size_t length) {
103+
void copyArray(const uint16_t *from, uint8_t *to, size_t length) {
104104
size_t i = 0;
105105
__m128i mask = _mm_set1_epi16(0xFF); // Mask to zero out the high byte
106106
for (; i + 7 < length; i += 8) {
@@ -116,7 +116,7 @@ inline void copyArray(const uint16_t *from, uint8_t *to, size_t length) {
116116
}
117117
}
118118
#else
119-
inline uint16_t getMaxValue(const uint16_t *arr, size_t length) {
119+
uint16_t getMaxValue(const uint16_t *arr, size_t length) {
120120
if (length == 0) {
121121
return 0; // Return 0 for empty arrays
122122
}
@@ -129,7 +129,7 @@ inline uint16_t getMaxValue(const uint16_t *arr, size_t length) {
129129
return max_val;
130130
}
131131

132-
inline void copyArray(const uint16_t *from, uint8_t *to, size_t length) {
132+
void copyArray(const uint16_t *from, uint8_t *to, size_t length) {
133133
// Fallback for systems without SSE2/NEON
134134
for (size_t i = 0; i < length; ++i) {
135135
to[i] = static_cast<uint8_t>(from[i]);

0 commit comments

Comments
 (0)