ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
array.h
Go to the documentation of this file.
1#ifndef _array_h_INCLUDED
2#define _array_h_INCLUDED
3
4#include "allocate.h"
5#include "stack.h"
6
7#include "global.h"
9
10#define ARRAY(TYPE) \
11 struct { \
12 TYPE *begin; \
13 TYPE *end; \
14 }
15
16#define ALLOCATE_ARRAY(A, N) \
17 do { \
18 const size_t TMP_N = (N); \
19 (A).begin = (A).end = \
20 kissat_nalloc (solver, TMP_N, sizeof *(A).begin); \
21 } while (0)
22
23#define EMPTY_ARRAY EMPTY_STACK
24#define SIZE_ARRAY SIZE_STACK
25
26#define PUSH_ARRAY(A, E) \
27 do { \
28 *(A).end++ = (E); \
29 } while (0)
30
31#define REALLOCATE_ARRAY(T, A, O, N) \
32 do { \
33 const size_t SIZE = SIZE_ARRAY (A); \
34 (A).begin = \
35 (T*) kissat_nrealloc (solver, (A).begin, (O), (N), sizeof *(A).begin); \
36 (A).end = (A).begin + SIZE; \
37 } while (0)
38
39#define RELEASE_ARRAY(A, N) \
40 do { \
41 const size_t TMP_NIZE = (N); \
42 DEALLOC ((A).begin, TMP_NIZE); \
43 } while (0)
44
45#define CLEAR_ARRAY CLEAR_STACK
46#define TOP_ARRAY TOP_STACK
47#define PEEK_ARRAY PEEK_STACK
48#define POKE_ARRAY POKE_STACK
49#define POP_ARRAY POP_STACK
50#define BEGIN_ARRAY BEGIN_STACK
51#define END_ARRAY END_STACK
52#define RESIZE_ARRAY RESIZE_STACK
53#define SET_END_OF_ARRAY SET_END_OF_STACK
54
55// clang-format off
56
57typedef ARRAY (unsigned) unsigned_array;
58
59// clang-format on
60
62
63#endif
#define ABC_NAMESPACE_HEADER_END
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
#define ARRAY(TYPE)
Definition array.h:10