Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion sources/extcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ typedef struct ExternalChannel {
int fsend; /*stdin of the external process*/
int killSignal; /*signal to kill*/
int daemonize;/*0 --neither setsid nor daemonize, !=0 -- full daemonization*/
PADPOINTER(0,3,0,0);
} EXTHANDLE;


Expand Down
75 changes: 1 addition & 74 deletions sources/form3.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ typedef ULONG RLONG; /* Used in reken.c. */
typedef int64_t MLONG; /* See commentary in minos.h. */
/*
* NOTE: we don't use the standard _Bool (or C++ bool) because its size is
* implementation-dependent and messes up the traditional PADXXX macros.
* implementation-dependent.
*/
typedef char BOOL;
/* E.g. in 32-bits */
Expand Down Expand Up @@ -279,79 +279,6 @@ template<typename T> struct calc {
#endif
#endif

/*
* Macros to be inserted at the end of a structure to align the whole structure.
*
* In the currently available systems,
* sizeof(POSITION) >= sizeof(pointers) == sizeof(LONG) >= sizeof(int)
* >= sizeof(WORD) >= sizeof(UBYTE) = 1.
* (POSITION is defined in struct.h and contains only an off_t variable.)
* Thus, if we put members of a structure in this order and use those macros,
* then we can align the data without relying on extra paddings added by
* the compiler. For example,
* typedef struct {
* int *a;
* LONG b;
* WORD c[2];
* UBYTE d;
* PADPOINTER(1,0,2,1);
* } A;
* typedef struct {
* POSITION p;
* A a; // aligned same as pointers
* int *b;
* LONG c;
* UBYTE d;
* PADPOSITION(1,1,0,0,1+sizeof(A));
* } B;
* The cost for the use of those PADXXX macros is a padding (>= 1 byte) will
* be always inserted even in the case that no padding is actually needed.
*
* Numbers for the arguments have to be calculated manually and so very
* error-prone. Be careful!
*
* Note that there is a 32-bit system in which off_t is aligned on 8-byte
* boundary, (e.g., Cygwin with large file support), but still the above
* inequalities are satisfied.
*
* The legendary story of these macros--they fixed some problems in ancient
* times when compilers were unreliable and didn't know how to correctly compute
* structure paddings--has been handed down, though nowadays there are only
* disadvantages for them in practice (ancient compilers most likely can't
* compile C99 and C++98+TR1 sources anyway).
*/
#define PADDUMMY(type, size) \
UBYTE d_u_m_m_y[form_alignof(type) - ((size) & (form_alignof(type) - 1))]
#define PADPOSITION(ptr_,long_,int_,word_,byte_) \
PADDUMMY(off_t, \
+ sizeof(int *) * (ptr_) \
+ sizeof(LONG) * (long_) \
+ sizeof(int) * (int_) \
+ sizeof(WORD) * (word_) \
+ sizeof(UBYTE) * (byte_) \
)
#define PADPOINTER(long_,int_,word_,byte_) \
PADDUMMY(int *, \
+ sizeof(LONG) * (long_) \
+ sizeof(int) * (int_) \
+ sizeof(WORD) * (word_) \
+ sizeof(UBYTE) * (byte_) \
)
#define PADLONG(int_,word_,byte_) \
PADDUMMY(LONG, \
+ sizeof(int) * (int_) \
+ sizeof(WORD) * (word_) \
+ sizeof(UBYTE) * (byte_) \
)
#define PADINT(word_,byte_) \
PADDUMMY(int, \
+ sizeof(WORD) * (word_) \
+ sizeof(UBYTE) * (byte_) \
)
#define PADWORD(byte_) \
PADDUMMY(WORD, \
+ sizeof(UBYTE) * (byte_) \
)

/*
#define WITHPCOUNTER
Expand Down
1 change: 0 additions & 1 deletion sources/optimize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ class tree_node {
int num_visits;
WORD var;
bool finished;
PADPOINTER(1,1,1,1);

tree_node (int _var=0):
sum_results(0), num_visits(0), var(_var), finished(false) {}
Expand Down
1 change: 0 additions & 1 deletion sources/parallel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2480,7 +2480,6 @@ typedef struct {
VectorStruct(WORD) buf;
LONG size;
WORD type;
PADPOINTER(1,0,1,0);
} dollar_buf;

/* Buffers used to store data for each variable from each slave. */
Expand Down
2 changes: 0 additions & 2 deletions sources/parallel.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ typedef struct {
int *from;
int numbufs; /* number of cyclic buffers */
int active; /* flag telling which buffer is active */
PADPOINTER(0,2,0,0);
} PF_BUFFER;

/*
Expand All @@ -182,7 +181,6 @@ typedef struct ParallelVars {
int log; /* flag for logging mode */
WORD numsbufs; /* number of cyclic send buffers (PF.sbuf->numbufs) */
WORD numrbufs; /* number of cyclic receive buffers (PF.rbufs[i]->numbufs, i=1,...numtasks-1) */
PADPOSITION(2,0,8,2,0);
} PARALLELVARS;

extern PARALLELVARS PF;
Expand Down
2 changes: 0 additions & 2 deletions sources/poly.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,6 @@ class poly {

static void push_heap (PHEAD WORD **, int);
static void pop_heap (PHEAD WORD **, int);

PADPOINTER(1,0,2,0);
};

// comparison class for monomials (for std::sort)
Expand Down
Loading
Loading