ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
macros.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define RandomInRange(u)   ((rand()>>3)%(u))
 
#define RandomInRangeFast(u)   ((rand()>>3)%(u))
 
#define amax(a, b)   ((a) >= (b) ? (a) : (b))
 
#define amin(a, b)   ((a) >= (b) ? (b) : (a))
 
#define AND(a, b)   ((a) < 0 ? ((-(a))&(b)) : ((a)&(b)))
 
#define OR(a, b)   ((a) < 0 ? -((-(a))|(b)) : ((a)|(b)))
 
#define XOR(a, b)   ((a) < 0 ? -((-(a))^(b)) : ((a)^(b)))
 
#define SWAP(a, b, tmp)    do {(tmp) = (a); (a) = (b); (b) = (tmp);} while(0)
 
#define INC_DEC(a, b, val)    do {(a) += (val); (b) -= (val);} while(0)
 
#define scopy(n, a, b)   (float *)memcpy((void *)(b), (void *)(a), sizeof(float)*(n))
 
#define idxcopy(n, a, b)   (idxtype *)memcpy((void *)(b), (void *)(a), sizeof(idxtype)*(n))
 
#define HASHFCT(key, size)   ((key)%(size))
 
#define cleartimer(tmr)   (tmr = 0.0)
 
#define starttimer(tmr)   (tmr -= seconds())
 
#define stoptimer(tmr)   (tmr += seconds())
 
#define gettimer(tmr)   (tmr)
 
#define IFSET(a, flag, cmd)   if ((a)&(flag)) (cmd);
 
#define MALLOC_CHECK(ptr)   ;
 
#define MAKECSR(i, n, a)
 
#define BNDInsert(nbnd, bndind, bndptr, vtx)
 
#define BNDDelete(nbnd, bndind, bndptr, vtx)
 
#define ASSERT(expr)   ;
 
#define ASSERTP(expr, msg)   ;
 

Macro Definition Documentation

◆ amax

#define amax (   a,
 
)    ((a) >= (b) ? (a) : (b))

Definition at line 24 of file macros.h.

◆ amin

#define amin (   a,
 
)    ((a) >= (b) ? (b) : (a))

Definition at line 25 of file macros.h.

◆ AND

#define AND (   a,
 
)    ((a) < 0 ? ((-(a))&(b)) : ((a)&(b)))

Definition at line 27 of file macros.h.

◆ ASSERT

#define ASSERT (   expr)    ;

Definition at line 125 of file macros.h.

◆ ASSERTP

#define ASSERTP (   expr,
  msg 
)    ;

Definition at line 137 of file macros.h.

◆ BNDDelete

#define BNDDelete (   nbnd,
  bndind,
  bndptr,
  vtx 
)
Value:
do { \
ASSERT(bndptr[vtx] != -1); \
bndind[bndptr[vtx]] = bndind[--nbnd]; \
bndptr[bndind[nbnd]] = bndptr[vtx]; \
bndptr[vtx] = -1; \
} while(0)

Definition at line 104 of file macros.h.

◆ BNDInsert

#define BNDInsert (   nbnd,
  bndind,
  bndptr,
  vtx 
)
Value:
do { \
ASSERT(bndptr[vtx] == -1); \
bndind[nbnd] = vtx; \
bndptr[vtx] = nbnd++;\
} while(0)

Definition at line 97 of file macros.h.

◆ cleartimer

#define cleartimer (   tmr)    (tmr = 0.0)

Definition at line 47 of file macros.h.

◆ gettimer

#define gettimer (   tmr)    (tmr)

Definition at line 50 of file macros.h.

◆ HASHFCT

#define HASHFCT (   key,
  size 
)    ((key)%(size))

Definition at line 41 of file macros.h.

◆ idxcopy

#define idxcopy (   n,
  a,
 
)    (idxtype *)memcpy((void *)(b), (void *)(a), sizeof(idxtype)*(n))

Definition at line 39 of file macros.h.

◆ IFSET

#define IFSET (   a,
  flag,
  cmd 
)    if ((a)&(flag)) (cmd);

Definition at line 56 of file macros.h.

◆ INC_DEC

#define INC_DEC (   a,
  b,
  val 
)     do {(a) += (val); (b) -= (val);} while(0)

Definition at line 34 of file macros.h.

◆ MAKECSR

#define MAKECSR (   i,
  n,
 
)
Value:
do { \
for (i=1; i<n; i++) a[i] += a[i-1]; \
for (i=n; i>0; i--) a[i] = a[i-1]; \
a[0] = 0; \
} while(0)

Definition at line 86 of file macros.h.

◆ MALLOC_CHECK

#define MALLOC_CHECK (   ptr)    ;

Definition at line 78 of file macros.h.

◆ OR

#define OR (   a,
 
)    ((a) < 0 ? -((-(a))|(b)) : ((a)|(b)))

Definition at line 28 of file macros.h.

◆ RandomInRange

#define RandomInRange (   u)    ((rand()>>3)%(u))

Definition at line 19 of file macros.h.

◆ RandomInRangeFast

#define RandomInRangeFast (   u)    ((rand()>>3)%(u))

Definition at line 20 of file macros.h.

◆ scopy

#define scopy (   n,
  a,
 
)    (float *)memcpy((void *)(b), (void *)(a), sizeof(float)*(n))

Definition at line 38 of file macros.h.

◆ starttimer

#define starttimer (   tmr)    (tmr -= seconds())

Definition at line 48 of file macros.h.

◆ stoptimer

#define stoptimer (   tmr)    (tmr += seconds())

Definition at line 49 of file macros.h.

◆ SWAP

#define SWAP (   a,
  b,
  tmp 
)     do {(tmp) = (a); (a) = (b); (b) = (tmp);} while(0)

Definition at line 31 of file macros.h.

◆ XOR

#define XOR (   a,
 
)    ((a) < 0 ? -((-(a))^(b)) : ((a)^(b)))

Definition at line 29 of file macros.h.