Go to the source code of this file.
|
| #define | min(a, b) |
| #define | max(a, b) |
| #define | mymalloc(ptr, nr, type) |
| #define | myrealloc(ptr, nr, type) |
| #define | myrandom(range) |
| #define | swap(a, b, tmp) |
| #define | seed() |
| #define | bit(var, d) |
| #define | negbit(var, d) |
| #define | waitkey() |
| #define | pord_resettimer(var) |
| #define | pord_starttimer(var) |
| #define | pord_stoptimer(var) |
| #define | quit() |
◆ bit
Value:
Definition at line 46 of file macros.h.
46#define bit(var, d) \
47 ((var) & (1 << (d)))
◆ max
◆ min
◆ mymalloc
| #define mymalloc |
( |
| ptr, |
|
|
| nr, |
|
|
| type ) |
Value: if (!(ptr = (type*)malloc((
max(nr,1)) *
sizeof(type)))) \
{ printf("malloc failed on line %d of file %s (nr=%d)\n", \
__LINE__, __FILE__, nr); \
}
Definition at line 23 of file macros.h.
23#define mymalloc(ptr, nr, type) \
24 if (!(ptr = (type*)malloc((max(nr,1)) * sizeof(type)))) \
25 { printf("malloc failed on line %d of file %s (nr=%d)\n", \
26 __LINE__, __FILE__, nr); \
27 exit(ERR); \
28 }
◆ myrandom
| #define myrandom |
( |
| range | ) |
|
Value:
Definition at line 37 of file macros.h.
37#define myrandom(range) \
38 rand() % (range);
◆ myrealloc
| #define myrealloc |
( |
| ptr, |
|
|
| nr, |
|
|
| type ) |
Value: if (!(ptr = (type*)realloc(ptr, (nr) * sizeof(type)))) \
{ printf("realloc failed on line %d of file %s (nr=%d)\n", \
__LINE__, __FILE__, nr); \
}
Definition at line 30 of file macros.h.
30#define myrealloc(ptr, nr, type) \
31 if (!(ptr = (type*)realloc(ptr, (nr) * sizeof(type)))) \
32 { printf("realloc failed on line %d of file %s (nr=%d)\n", \
33 __LINE__, __FILE__, nr); \
34 exit(ERR); \
35 }
◆ negbit
| #define negbit |
( |
| var, |
|
|
| d ) |
Value:
Definition at line 49 of file macros.h.
49#define negbit(var, d) \
50 ((var) ^ (1 << (d)))
◆ pord_resettimer
| #define pord_resettimer |
( |
| var | ) |
|
Value:
Definition at line 55 of file macros.h.
55#define pord_resettimer(var) \
56 var = 0;
◆ pord_starttimer
| #define pord_starttimer |
( |
| var | ) |
|
Value: var -= ((
FLOAT)clock()/CLOCKS_PER_SEC);
Definition at line 58 of file macros.h.
58#define pord_starttimer(var) \
59 var -= ((FLOAT)clock()/CLOCKS_PER_SEC);
◆ pord_stoptimer
| #define pord_stoptimer |
( |
| var | ) |
|
Value: var += ((
FLOAT)clock()/CLOCKS_PER_SEC);
Definition at line 61 of file macros.h.
61#define pord_stoptimer(var) \
62 var += ((FLOAT)clock()/CLOCKS_PER_SEC);
◆ quit
Value:
Definition at line 64 of file macros.h.
64#define quit() \
65 exit(ERR);
◆ seed
Value:
Definition at line 43 of file macros.h.
43#define seed() \
44 srand((PORD_INT)time(0) % 10000);
◆ swap
| #define swap |
( |
| a, |
|
|
| b, |
|
|
| tmp ) |
Value: { (tmp) = (a); (a) = (b); (b) = (tmp); }
Definition at line 40 of file macros.h.
40#define swap(a, b, tmp) \
41 { (tmp) = (a); (a) = (b); (b) = (tmp); }
◆ waitkey
Value:
Definition at line 52 of file macros.h.
52#define waitkey() \
53 { char _s[MAX_LINE_LEN]; printf("\n<RETURN>"); gets(_s); }