Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
Index.h
Go to the documentation of this file.
1 //
5 //
6 
7 #ifndef _INC_Index_H
8 #define _INC_Index_H
9 #ifndef NO_PRAGMA_ONCE
10 #pragma once
11 #endif
12 
13 #include "GrayCore.h"
14 
15 namespace Gray
16 {
17 
18 #ifdef USE_64BIT
19 #define _SIZEOF_PTR 8
20 #define USE_FILE_POS64
21 #else
22 #define _SIZEOF_PTR 4
23 #endif
24 
25 #if (_MFC_VER > 0x0600)
26  typedef INT_PTR ITERATE_t;
27 #else
28  typedef int ITERATE_t;
29 #endif
31 
32  typedef size_t COUNT_t;
33 
34 #define IS_INDEX_BAD(i,q) ((COUNT_t)(i)>=(COUNT_t)(q))
35 #define IS_INDEX_GOOD(i,q) ((COUNT_t)(i)<(COUNT_t)(q))
36 
37 #define IS_INDEX_BAD_ARRAY(i,a) IS_INDEX_BAD(i,_countof(a))
38 #define IS_INDEX_GOOD_ARRAY(i,a) IS_INDEX_GOOD(i,_countof(a))
39 
40  template< typename TYPE >
41  static inline ptrdiff_t GET_INDEX_IN(TYPE a, TYPE b)
42  {
46  return b - a;
47  }
48 
49 #define _sizeofm(s,m) sizeof(((s *)0)->m)
50 
51 }
52 
53 #endif
54 
55 
#define TYPE
Definition: StrT.cpp:38
< The main namespace for all Core functions.
Definition: GrayCore.cpp:14
size_t COUNT_t
like size_t but a count of things that might NOT be bytes. ASSUME unsigned. _countof(x)
Definition: Index.h:32
int ITERATE_t
like size_t but signed
Definition: Index.h:28
const ITERATE_t k_ITERATE_BAD
Definition: Index.h:30