tesseract  4.00.00dev
host.h File Reference
#include <limits>
#include "platform.h"
#include <cinttypes>
#include <cstdint>

Go to the source code of this file.

Macros

#define MAX_INT8   0x7f
 
#define MAX_INT16   0x7fff
 
#define MAX_INT32   0x7fffffff
 
#define MAX_UINT8   0xff
 
#define MAX_UINT16   0xffff
 
#define MAX_UINT32   0xffffffff
 
#define MAX_FLOAT32   std::numeric_limits<float>::max()
 
#define MIN_INT8   static_cast<inT8>(0x80)
 
#define MIN_INT16   static_cast<inT16>(0x8000)
 
#define MIN_INT32   static_cast<inT32>(0x80000000)
 
#define MIN_UINT8   0x00
 
#define MIN_UINT16   0x0000
 
#define MIN_UINT32   0x00000000
 
#define MIN_FLOAT32   std::numeric_limits<float>::min()
 
#define TRUE   1
 
#define FALSE   0
 

Typedefs

typedef int8_t inT8
 
typedef uint8_t uinT8
 
typedef int16_t inT16
 
typedef uint16_t uinT16
 
typedef int32_t inT32
 
typedef uint32_t uinT32
 
typedef int64_t inT64
 
typedef uint64_t uinT64
 
typedef float FLOAT32
 
typedef double FLOAT64
 
typedef unsigned char BOOL8
 

Functions

template<class T >
bool NearlyEqual (T x, T y, T tolerance)
 

Macro Definition Documentation

◆ FALSE

#define FALSE   0

Definition at line 83 of file host.h.

◆ MAX_FLOAT32

#define MAX_FLOAT32   std::numeric_limits<float>::max()

Definition at line 66 of file host.h.

◆ MAX_INT16

#define MAX_INT16   0x7fff

Definition at line 61 of file host.h.

◆ MAX_INT32

#define MAX_INT32   0x7fffffff

Definition at line 62 of file host.h.

◆ MAX_INT8

#define MAX_INT8   0x7f

Definition at line 60 of file host.h.

◆ MAX_UINT16

#define MAX_UINT16   0xffff

Definition at line 64 of file host.h.

◆ MAX_UINT32

#define MAX_UINT32   0xffffffff

Definition at line 65 of file host.h.

◆ MAX_UINT8

#define MAX_UINT8   0xff

Definition at line 63 of file host.h.

◆ MIN_FLOAT32

#define MIN_FLOAT32   std::numeric_limits<float>::min()

Definition at line 75 of file host.h.

◆ MIN_INT16

#define MIN_INT16   static_cast<inT16>(0x8000)

Definition at line 69 of file host.h.

◆ MIN_INT32

#define MIN_INT32   static_cast<inT32>(0x80000000)

Definition at line 70 of file host.h.

◆ MIN_INT8

#define MIN_INT8   static_cast<inT8>(0x80)

Definition at line 68 of file host.h.

◆ MIN_UINT16

#define MIN_UINT16   0x0000

Definition at line 72 of file host.h.

◆ MIN_UINT32

#define MIN_UINT32   0x00000000

Definition at line 73 of file host.h.

◆ MIN_UINT8

#define MIN_UINT8   0x00

Definition at line 71 of file host.h.

◆ TRUE

#define TRUE   1

Definition at line 79 of file host.h.

Typedef Documentation

◆ BOOL8

typedef unsigned char BOOL8

Definition at line 44 of file host.h.

◆ FLOAT32

typedef float FLOAT32

Definition at line 42 of file host.h.

◆ FLOAT64

typedef double FLOAT64

Definition at line 43 of file host.h.

◆ inT16

typedef int16_t inT16

Definition at line 36 of file host.h.

◆ inT32

typedef int32_t inT32

Definition at line 38 of file host.h.

◆ inT64

typedef int64_t inT64

Definition at line 40 of file host.h.

◆ inT8

typedef int8_t inT8

Definition at line 34 of file host.h.

◆ uinT16

typedef uint16_t uinT16

Definition at line 37 of file host.h.

◆ uinT32

typedef uint32_t uinT32

Definition at line 39 of file host.h.

◆ uinT64

typedef uint64_t uinT64

Definition at line 41 of file host.h.

◆ uinT8

typedef uint8_t uinT8

Definition at line 35 of file host.h.

Function Documentation

◆ NearlyEqual()

template<class T >
bool NearlyEqual ( x,
y,
tolerance 
)

Definition at line 87 of file host.h.

87  {
88  T diff = x - y;
89  return diff <= tolerance && -diff <= tolerance;
90 }