Skip to content

Commit 9ceb0c6

Browse files
committed
Fix line endings
Replace DOS line endings (CRLF) by standard (LF only). Signed-off-by: Stefan Weil <sw@weilnetz.de>
1 parent 104fe79 commit 9ceb0c6

File tree

146 files changed

+35442
-35442
lines changed

Some content is hidden

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

146 files changed

+35442
-35442
lines changed

src/arch/dotproductavx.h

+30-30
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
///////////////////////////////////////////////////////////////////////
2-
// File: dotproductavx.h
3-
// Description: Architecture-specific dot-product function.
4-
// Author: Ray Smith
5-
// Created: Wed Jul 22 10:51:05 PDT 2015
6-
//
7-
// (C) Copyright 2015, Google Inc.
8-
// Licensed under the Apache License, Version 2.0 (the "License");
9-
// you may not use this file except in compliance with the License.
10-
// You may obtain a copy of the License at
11-
// http://www.apache.org/licenses/LICENSE-2.0
12-
// Unless required by applicable law or agreed to in writing, software
13-
// distributed under the License is distributed on an "AS IS" BASIS,
14-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
// See the License for the specific language governing permissions and
16-
// limitations under the License.
17-
///////////////////////////////////////////////////////////////////////
18-
19-
#ifndef TESSERACT_ARCH_DOTPRODUCTAVX_H_
20-
#define TESSERACT_ARCH_DOTPRODUCTAVX_H_
21-
22-
namespace tesseract {
23-
24-
// Computes and returns the dot product of the n-vectors u and v.
25-
// Uses Intel AVX intrinsics to access the SIMD instruction set.
26-
double DotProductAVX(const double* u, const double* v, int n);
27-
28-
} // namespace tesseract.
29-
30-
#endif // TESSERACT_ARCH_DOTPRODUCTAVX_H_
1+
///////////////////////////////////////////////////////////////////////
2+
// File: dotproductavx.h
3+
// Description: Architecture-specific dot-product function.
4+
// Author: Ray Smith
5+
// Created: Wed Jul 22 10:51:05 PDT 2015
6+
//
7+
// (C) Copyright 2015, Google Inc.
8+
// Licensed under the Apache License, Version 2.0 (the "License");
9+
// you may not use this file except in compliance with the License.
10+
// You may obtain a copy of the License at
11+
// http://www.apache.org/licenses/LICENSE-2.0
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
///////////////////////////////////////////////////////////////////////
18+
19+
#ifndef TESSERACT_ARCH_DOTPRODUCTAVX_H_
20+
#define TESSERACT_ARCH_DOTPRODUCTAVX_H_
21+
22+
namespace tesseract {
23+
24+
// Computes and returns the dot product of the n-vectors u and v.
25+
// Uses Intel AVX intrinsics to access the SIMD instruction set.
26+
double DotProductAVX(const double* u, const double* v, int n);
27+
28+
} // namespace tesseract.
29+
30+
#endif // TESSERACT_ARCH_DOTPRODUCTAVX_H_

src/arch/dotproductsse.h

+35-35
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
///////////////////////////////////////////////////////////////////////
2-
// File: dotproductsse.h
3-
// Description: Architecture-specific dot-product function.
4-
// Author: Ray Smith
5-
// Created: Wed Jul 22 10:57:05 PDT 2015
6-
//
7-
// (C) Copyright 2015, Google Inc.
8-
// Licensed under the Apache License, Version 2.0 (the "License");
9-
// you may not use this file except in compliance with the License.
10-
// You may obtain a copy of the License at
11-
// http://www.apache.org/licenses/LICENSE-2.0
12-
// Unless required by applicable law or agreed to in writing, software
13-
// distributed under the License is distributed on an "AS IS" BASIS,
14-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
// See the License for the specific language governing permissions and
16-
// limitations under the License.
17-
///////////////////////////////////////////////////////////////////////
18-
19-
#ifndef TESSERACT_ARCH_DOTPRODUCTSSE_H_
20-
#define TESSERACT_ARCH_DOTPRODUCTSSE_H_
21-
22-
#include "host.h"
23-
24-
namespace tesseract {
25-
26-
// Computes and returns the dot product of the n-vectors u and v.
27-
// Uses Intel SSE intrinsics to access the SIMD instruction set.
28-
double DotProductSSE(const double* u, const double* v, int n);
29-
// Computes and returns the dot product of the n-vectors u and v.
30-
// Uses Intel SSE intrinsics to access the SIMD instruction set.
31-
int32_t IntDotProductSSE(const int8_t* u, const int8_t* v, int n);
32-
33-
} // namespace tesseract.
34-
35-
#endif // TESSERACT_ARCH_DOTPRODUCTSSE_H_
1+
///////////////////////////////////////////////////////////////////////
2+
// File: dotproductsse.h
3+
// Description: Architecture-specific dot-product function.
4+
// Author: Ray Smith
5+
// Created: Wed Jul 22 10:57:05 PDT 2015
6+
//
7+
// (C) Copyright 2015, Google Inc.
8+
// Licensed under the Apache License, Version 2.0 (the "License");
9+
// you may not use this file except in compliance with the License.
10+
// You may obtain a copy of the License at
11+
// http://www.apache.org/licenses/LICENSE-2.0
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
///////////////////////////////////////////////////////////////////////
18+
19+
#ifndef TESSERACT_ARCH_DOTPRODUCTSSE_H_
20+
#define TESSERACT_ARCH_DOTPRODUCTSSE_H_
21+
22+
#include "host.h"
23+
24+
namespace tesseract {
25+
26+
// Computes and returns the dot product of the n-vectors u and v.
27+
// Uses Intel SSE intrinsics to access the SIMD instruction set.
28+
double DotProductSSE(const double* u, const double* v, int n);
29+
// Computes and returns the dot product of the n-vectors u and v.
30+
// Uses Intel SSE intrinsics to access the SIMD instruction set.
31+
int32_t IntDotProductSSE(const int8_t* u, const int8_t* v, int n);
32+
33+
} // namespace tesseract.
34+
35+
#endif // TESSERACT_ARCH_DOTPRODUCTSSE_H_

src/arch/simddetect.cpp

+82-82
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,82 @@
1-
///////////////////////////////////////////////////////////////////////
2-
// File: simddetect.cpp
3-
// Description: Architecture detector.
4-
// Author: Stefan Weil (based on code from Ray Smith)
5-
//
6-
// (C) Copyright 2014, Google Inc.
7-
// Licensed under the Apache License, Version 2.0 (the "License");
8-
// you may not use this file except in compliance with the License.
9-
// You may obtain a copy of the License at
10-
// http://www.apache.org/licenses/LICENSE-2.0
11-
// Unless required by applicable law or agreed to in writing, software
12-
// distributed under the License is distributed on an "AS IS" BASIS,
13-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
// See the License for the specific language governing permissions and
15-
// limitations under the License.
16-
///////////////////////////////////////////////////////////////////////
17-
18-
#include "simddetect.h"
19-
#include "tprintf.h"
20-
21-
#undef X86_BUILD
22-
#if defined(__x86_64__) || defined(__i386__) || defined(_WIN32)
23-
#if !defined(ANDROID_BUILD)
24-
#define X86_BUILD 1
25-
#endif // !ANDROID_BUILD
26-
#endif // x86 target
27-
28-
#if defined(X86_BUILD)
29-
#if defined(__GNUC__)
30-
#include <cpuid.h>
31-
#elif defined(_WIN32)
32-
#include <intrin.h>
33-
#endif
34-
#endif
35-
36-
SIMDDetect SIMDDetect::detector;
37-
38-
// If true, then AVX has been detected.
39-
bool SIMDDetect::avx_available_;
40-
bool SIMDDetect::avx2_available_;
41-
bool SIMDDetect::avx512F_available_;
42-
bool SIMDDetect::avx512BW_available_;
43-
// If true, then SSe4.1 has been detected.
44-
bool SIMDDetect::sse_available_;
45-
46-
// Constructor.
47-
// Tests the architecture in a system-dependent way to detect AVX, SSE and
48-
// any other available SIMD equipment.
49-
// __GNUC__ is also defined by compilers that include GNU extensions such as
50-
// clang.
51-
SIMDDetect::SIMDDetect() {
52-
#if defined(X86_BUILD)
53-
#if defined(__GNUC__)
54-
unsigned int eax, ebx, ecx, edx;
55-
if (__get_cpuid(1, &eax, &ebx, &ecx, &edx) != 0) {
56-
// Note that these tests all use hex because the older compilers don't have
57-
// the newer flags.
58-
sse_available_ = (ecx & 0x00080000) != 0;
59-
avx_available_ = (ecx & 0x10000000) != 0;
60-
if (avx_available_) {
61-
// There is supposed to be a __get_cpuid_count function, but this is all
62-
// there is in my cpuid.h. It is a macro for an asm statement and cannot
63-
// be used inside an if.
64-
__cpuid_count(7, 0, eax, ebx, ecx, edx);
65-
avx2_available_ = (ebx & 0x00000020) != 0;
66-
avx512F_available_ = (ebx & 0x00010000) != 0;
67-
avx512BW_available_ = (ebx & 0x40000000) != 0;
68-
}
69-
}
70-
#elif defined(_WIN32)
71-
int cpuInfo[4];
72-
__cpuid(cpuInfo, 0);
73-
if (cpuInfo[0] >= 1) {
74-
__cpuid(cpuInfo, 1);
75-
sse_available_ = (cpuInfo[2] & 0x00080000) != 0;
76-
avx_available_ = (cpuInfo[2] & 0x10000000) != 0;
77-
}
78-
#else
79-
#error "I don't know how to test for SIMD with this compiler"
80-
#endif
81-
#endif // X86_BUILD
82-
}
1+
///////////////////////////////////////////////////////////////////////
2+
// File: simddetect.cpp
3+
// Description: Architecture detector.
4+
// Author: Stefan Weil (based on code from Ray Smith)
5+
//
6+
// (C) Copyright 2014, Google Inc.
7+
// Licensed under the Apache License, Version 2.0 (the "License");
8+
// you may not use this file except in compliance with the License.
9+
// You may obtain a copy of the License at
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
// Unless required by applicable law or agreed to in writing, software
12+
// distributed under the License is distributed on an "AS IS" BASIS,
13+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
// See the License for the specific language governing permissions and
15+
// limitations under the License.
16+
///////////////////////////////////////////////////////////////////////
17+
18+
#include "simddetect.h"
19+
#include "tprintf.h"
20+
21+
#undef X86_BUILD
22+
#if defined(__x86_64__) || defined(__i386__) || defined(_WIN32)
23+
#if !defined(ANDROID_BUILD)
24+
#define X86_BUILD 1
25+
#endif // !ANDROID_BUILD
26+
#endif // x86 target
27+
28+
#if defined(X86_BUILD)
29+
#if defined(__GNUC__)
30+
#include <cpuid.h>
31+
#elif defined(_WIN32)
32+
#include <intrin.h>
33+
#endif
34+
#endif
35+
36+
SIMDDetect SIMDDetect::detector;
37+
38+
// If true, then AVX has been detected.
39+
bool SIMDDetect::avx_available_;
40+
bool SIMDDetect::avx2_available_;
41+
bool SIMDDetect::avx512F_available_;
42+
bool SIMDDetect::avx512BW_available_;
43+
// If true, then SSe4.1 has been detected.
44+
bool SIMDDetect::sse_available_;
45+
46+
// Constructor.
47+
// Tests the architecture in a system-dependent way to detect AVX, SSE and
48+
// any other available SIMD equipment.
49+
// __GNUC__ is also defined by compilers that include GNU extensions such as
50+
// clang.
51+
SIMDDetect::SIMDDetect() {
52+
#if defined(X86_BUILD)
53+
#if defined(__GNUC__)
54+
unsigned int eax, ebx, ecx, edx;
55+
if (__get_cpuid(1, &eax, &ebx, &ecx, &edx) != 0) {
56+
// Note that these tests all use hex because the older compilers don't have
57+
// the newer flags.
58+
sse_available_ = (ecx & 0x00080000) != 0;
59+
avx_available_ = (ecx & 0x10000000) != 0;
60+
if (avx_available_) {
61+
// There is supposed to be a __get_cpuid_count function, but this is all
62+
// there is in my cpuid.h. It is a macro for an asm statement and cannot
63+
// be used inside an if.
64+
__cpuid_count(7, 0, eax, ebx, ecx, edx);
65+
avx2_available_ = (ebx & 0x00000020) != 0;
66+
avx512F_available_ = (ebx & 0x00010000) != 0;
67+
avx512BW_available_ = (ebx & 0x40000000) != 0;
68+
}
69+
}
70+
#elif defined(_WIN32)
71+
int cpuInfo[4];
72+
__cpuid(cpuInfo, 0);
73+
if (cpuInfo[0] >= 1) {
74+
__cpuid(cpuInfo, 1);
75+
sse_available_ = (cpuInfo[2] & 0x00080000) != 0;
76+
avx_available_ = (cpuInfo[2] & 0x10000000) != 0;
77+
}
78+
#else
79+
#error "I don't know how to test for SIMD with this compiler"
80+
#endif
81+
#endif // X86_BUILD
82+
}

0 commit comments

Comments
 (0)