Skip to content

Commit 151769c

Browse files
committed
Add clang on the CI for windows and linux
1 parent c08d227 commit 151769c

File tree

4 files changed

+11
-57
lines changed

4 files changed

+11
-57
lines changed

ClientSource/Connection/SerialConnectionWinAPI.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class SerialConnection : public StreamConnection{
4444
throw ConnectionException(nullptr, "Unable to open serial connection (" + name + "). Error = " + std::to_string(error));
4545
}
4646

47-
DCB serial_params{0};
47+
DCB serial_params{};
4848
serial_params.DCBlength = sizeof(serial_params);
4949

5050
if (!GetCommState(m_handle, &serial_params)){
@@ -67,7 +67,7 @@ class SerialConnection : public StreamConnection{
6767
}
6868

6969
#if 1
70-
COMMTIMEOUTS timeouts{0};
70+
COMMTIMEOUTS timeouts{};
7171
if (!GetCommTimeouts(m_handle, &timeouts)){
7272
DWORD error = GetLastError();
7373
CloseHandle(m_handle);

SerialPrograms/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2507,6 +2507,15 @@ if (WIN32)
25072507
set(ARCH_FLAGS_19_IceLake /arch:AVX512)
25082508
endif()
25092509

2510+
if(CMAKE_GENERATOR_TOOLSET MATCHES "ClangCL")
2511+
target_compile_options(SerialPrograms PRIVATE -msse4.2)
2512+
set(ARCH_FLAGS_09_Nehalem -march=nehalem)
2513+
set(ARCH_FLAGS_13_Haswell -march=haswell)
2514+
set(ARCH_FLAGS_17_Skylake -march=skylake-avx512)
2515+
set(ARCH_FLAGS_19_IceLake -march=icelake-client)
2516+
# target_compile_options(SerialPrograms PRIVATE -mavx512f -mavx512vnni -mcrc32 -mevex512 -mgfni -mpopcnt -msse4.1 -msse4.2)
2517+
endif()
2518+
25102519
# Run-time ISA dispatching
25112520
target_compile_definitions(SerialPrograms PRIVATE PA_AutoDispatch_x64_08_Nehalem)
25122521
target_compile_definitions(SerialPrograms PRIVATE PA_AutoDispatch_x64_13_Haswell)

SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramSwitch.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ class TestProgram : public MultiSwitchProgramInstance, public ButtonListener{
7373
StringOption IMAGE_PATH;
7474

7575
StaticTextOption STATIC_TEXT;
76-
BoxFloatOption BOX;
7776

7877

7978
// PokemonSV::SinglesAIOption battle_AI;

SerialPrograms/Source/PokemonLA/Inference/Map/PokemonLA_PokemonMapSpriteReader.cpp

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,6 @@ FeatureType feature_distance(const FeatureVector& a, const FeatureVector& b){
8686
return sum;
8787
}
8888

89-
std::string feature_to_str(const FeatureVector& a){
90-
std::ostringstream os;
91-
os << "[";
92-
for(size_t i = 0; i < a.size(); i++){
93-
if (i != 0){
94-
os << ", ";
95-
}
96-
os << a[i];
97-
}
98-
os << "]";
99-
return os.str();
100-
}
101-
10289
void run_Sobel_gradient_filter(const ImageViewRGB32& image, std::function<void(size_t x, size_t y, int sum_x[3], int sum_y[3])> process_gradient){
10390
const size_t width = image.width();
10491
const size_t height = image.height();
@@ -275,47 +262,6 @@ ImageRGB32 compute_image_gradient(const ImageViewRGB32& image){
275262
return result;
276263
}
277264

278-
FeatureVector compute_gradient_histogram(const ImageViewRGB32& image){
279-
const int num_angle_divisions = 8;
280-
double division_angle = 2. * M_PI / num_angle_divisions;
281-
double inverse_division_angle = 1.0 / division_angle;
282-
283-
std::array<int, num_angle_divisions> bin = {0};
284-
285-
int num_grad = 0;
286-
287-
run_Sobel_gradient_filter(image, [&](size_t x, size_t y, int sum_x[3], int sum_y[3]){
288-
int gx = sum_x[0] + sum_x[1] + sum_x[2];
289-
int gy = sum_y[0] + sum_y[1] + sum_y[2];
290-
if (gx*gx + gy*gy <= 2000){
291-
return;
292-
}
293-
num_grad++;
294-
295-
// if (count == 0){
296-
// // cout << "gxy " << sum_x[0] << " " << sum_x[1] << " " << sum_x[2] << ", " <<
297-
// // sum_y[0] << " " << sum_y[1] << " " << sum_y[2] << endl;
298-
// int gxc = std::min(std::abs(gx), 255);
299-
// int gyc = std::min(std::abs(gy), 255);
300-
301-
// output_image->setPixelColor(x, y, QColor(gxc, gyc, 0));
302-
// }
303-
304-
double angle = std::atan2(gy, gx); // range in -pi, pi
305-
int bin_idx = int((angle + M_PI) * inverse_division_angle);
306-
// clamp bin to [0, 11]
307-
bin_idx = std::min(std::max(bin_idx, 0), num_angle_divisions-1);
308-
bin[bin_idx]++;
309-
});
310-
311-
FeatureVector result(num_angle_divisions);
312-
for(size_t i = 0; i < num_angle_divisions; i++){
313-
result[i] = bin[i] / (FeatureType)num_grad;
314-
}
315-
316-
return result;
317-
}
318-
319265
} // end anonymous namespace
320266

321267
FeatureVector compute_feature(const ImageViewRGB32& input_image){

0 commit comments

Comments
 (0)