tesseract
4.1.1
host.h
Go to the documentation of this file.
1
/******************************************************************************
2
** Filename: host.h
3
** Purpose: This is the system independent typedefs and defines
4
** Author: MN, JG, MD
5
**
6
** (c) Copyright Hewlett-Packard Company, 1988-1996.
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
#ifndef TESSERACT_CCUTIL_HOST_H_
19
#define TESSERACT_CCUTIL_HOST_H_
20
21
#include <limits>
22
#include "
platform.h
"
23
/* _WIN32 */
24
#ifdef _WIN32
25
# ifndef NOMINMAX
26
# define NOMINMAX
27
# endif
/* NOMINMAX */
28
# ifndef WIN32_LEAN_AND_MEAN
29
# define WIN32_LEAN_AND_MEAN
30
# endif
31
#include <windows.h>
32
#undef min
33
#undef max
34
#endif // _WIN32
35
36
// Return true if x is within tolerance of y
37
template
<
class
T>
bool
NearlyEqual
(T x, T y, T tolerance) {
38
T diff = x - y;
39
return
diff <= tolerance && -diff <= tolerance;
40
}
41
42
#endif // TESSERACT_CCUTIL_HOST_H_
NearlyEqual
bool NearlyEqual(T x, T y, T tolerance)
Definition:
host.h:37
platform.h
src
ccutil
host.h
Generated on Thu Mar 26 2020 00:00:00 for tesseract by
1.8.18