Skip to content

Commit e836b13

Browse files
Apply pre-commit auto-fixes
1 parent c8d9a9a commit e836b13

File tree

69 files changed

+589
-213
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+589
-213
lines changed

apps/HelloAndroid/jni/hello_wrapper.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ JNIEXPORT void JNICALL Java_com_example_hellohalide_CameraPreview_processFrame(
121121
counter++;
122122
unsigned min = times[0];
123123
for (int i = 1; i < 16; i++) {
124-
if (times[i] < min) min = times[i];
124+
if (times[i] < min) {
125+
min = times[i];
126+
}
125127
}
126128
LOGD("Time taken: %d (%d)", elapsed_us, min);
127129
}

apps/HelloAndroidCamera2/jni/YuvBufferT.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ void YuvBufferT::fillUV(uint8_t u, uint8_t v) {
152152

153153
namespace {
154154
Halide::Runtime::Buffer<uint8_t> rotateBuffer180(Halide::Runtime::Buffer<uint8_t> buf) {
155-
if (buf.data() == nullptr) return buf;
155+
if (buf.data() == nullptr) {
156+
return buf;
157+
}
156158
halide_dimension_t shape[] = {
157159
{0, buf.dim(0).extent(), -buf.dim(0).stride()},
158160
{0, buf.dim(1).extent(), -buf.dim(1).stride()},

apps/blur/test.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,17 @@ Buffer<uint16_t, 2> blur(Buffer<uint16_t, 2> in) {
2020
Buffer<uint16_t, 2> out(in.width() - 8, in.height() - 2);
2121

2222
t = benchmark(10, 1, [&]() {
23-
for (int y = 0; y < tmp.height(); y++)
24-
for (int x = 0; x < tmp.width(); x++)
23+
for (int y = 0; y < tmp.height(); y++) {
24+
for (int x = 0; x < tmp.width(); x++) {
2525
tmp(x, y) = (in(x, y) + in(x + 1, y) + in(x + 2, y)) / 3;
26+
}
27+
}
2628

27-
for (int y = 0; y < out.height(); y++)
28-
for (int x = 0; x < out.width(); x++)
29+
for (int y = 0; y < out.height(); y++) {
30+
for (int x = 0; x < out.width(); x++) {
2931
out(x, y) = (tmp(x, y) + tmp(x, y + 1) + tmp(x, y + 2)) / 3;
32+
}
33+
}
3034
});
3135

3236
return out;

apps/hannk/interpreter/model.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,30 @@ namespace hannk {
2323
Op::Op(std::vector<TensorPtr> inputs, std::vector<TensorPtr> outputs)
2424
: inputs_(std::move(inputs)), outputs_(std::move(outputs)) {
2525
for (auto &i : inputs_) {
26-
if (!i) continue;
26+
if (!i) {
27+
continue;
28+
}
2729
i->add_consumer(this);
2830
}
2931
for (auto &i : outputs_) {
30-
if (!i) continue;
32+
if (!i) {
33+
continue;
34+
}
3135
i->add_producer(this);
3236
}
3337
}
3438

3539
Op::~Op() {
3640
for (auto &i : inputs_) {
37-
if (!i) continue;
41+
if (!i) {
42+
continue;
43+
}
3844
i->remove_consumer(this);
3945
}
4046
for (auto &i : outputs_) {
41-
if (!i) continue;
47+
if (!i) {
48+
continue;
49+
}
4250
i->remove_producer(this);
4351
}
4452
}

apps/hannk/util/buffer_util.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ struct CompareBuffers {
148148
if (do_log) {
149149
std::cerr << "*** " << msg << " at (";
150150
for (int i = 0; i < expected_buf.dimensions(); ++i) {
151-
if (i > 0) std::cerr << ", ";
151+
if (i > 0) {
152+
std::cerr << ", ";
153+
}
152154
std::cerr << pos[i];
153155
}
154156
std::cerr << "): expected " << 0 + expected << " actual " << 0 + actual << " diff " << 0 + diff << "\n";
@@ -239,7 +241,9 @@ struct DumpBuffer {
239241
T val = buf(pos);
240242
std::cerr << "Value at (";
241243
for (int i = 0; i < buf.dimensions(); ++i) {
242-
if (i > 0) std::cerr << ", ";
244+
if (i > 0) {
245+
std::cerr << ", ";
246+
}
243247
std::cerr << pos[i];
244248
}
245249
std::cerr << "): " << 0 + val << "\n";

apps/hexagon_benchmarks/process.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@
2929

3030
template<typename T>
3131
T clamp(T val, T min, T max) {
32-
if (val < min)
32+
if (val < min) {
3333
return min;
34-
if (val > max)
34+
}
35+
if (val > max) {
3536
return max;
37+
}
3638
return val;
3739
}
3840

apps/hexagon_dma/mock_dma_implementation.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,9 @@ int32 nDmaWrapper_Move(t_DmaWrapper_DmaEngineHandle handle) {
176176
fprintf(stderr, "Processing line -- yii: %u ydst: %u frame_offset: %u ysrc: %u len: %u\n",
177177
yii, ydst, frame_offset, ysrc, len);
178178
} else {
179-
if (cnt == (h - DBG_LOG_LINES)) cnt = 0; // log last few lines
179+
if (cnt == (h - DBG_LOG_LINES)) {
180+
cnt = 0; // log last few lines
181+
}
180182
}
181183
#endif
182184
}
@@ -219,11 +221,13 @@ int32 nDmaWrapper_GetRecommendedIntermBufStride(t_eDmaFmt fmt,
219221

220222
int32 nDmaWrapper_DmaTransferSetup(t_DmaWrapper_DmaEngineHandle handle, t_StDmaWrapper_DmaTransferSetup *dma_transfer_parm) {
221223

222-
if (handle == 0)
224+
if (handle == 0) {
223225
return 1;
226+
}
224227

225-
if (dma_transfer_parm->pDescBuf == NULL)
228+
if (dma_transfer_parm->pDescBuf == NULL) {
226229
return 1;
230+
}
227231

228232
// Add it to the linked list of dma_handle->ptr
229233
dma_handle_t *dma_handle = (dma_handle_t *)handle;

apps/hexagon_dma/process_raw_linear_interleaved_basic.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ int main(int argc, char **argv) {
166166
uint8_t result = (!strcmp(dma_direction, "rw")) ? data_out[x * 4 + z + y * width * 4] : output(x, y, z);
167167
if (correct != result) {
168168
printf("Mismatch at x=%d y=%d z=%d: %d != %d\n", x, y, z, correct, result);
169-
if (++error_count > 20) abort();
169+
if (++error_count > 20) {
170+
abort();
171+
}
170172
}
171173
}
172174
}

apps/hexagon_dma/process_yuv_linear_basic.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,9 @@ inline int process_pipeline(T const &type, const int width, const int height,
219219
T result = (!strcmp(dma_direction, "rw")) ? data_out[x + y * width] : output(x, y);
220220
if (correct != result) {
221221
printf("Mismatch at x=%d y=%d : %d != %d\n", x, y, correct, result);
222-
if (++error_count > 20) abort();
222+
if (++error_count > 20) {
223+
abort();
224+
}
223225
}
224226
}
225227
}

apps/resnet_50/Resnet50Generator.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ struct WeightShape {
2121
// returns index of found value in array or -1 if not in array
2222
int find_index(int value, std::vector<int> vec) {
2323
std::vector<int>::iterator it = std::find(vec.begin(), vec.end(), value);
24-
if (it == vec.end())
24+
if (it == vec.end()) {
2525
return -1;
26+
}
2627
return std::distance(vec.begin(), it);
2728
}
2829

0 commit comments

Comments
 (0)