1 /* $Id: impl.h,v 1.3 1994/06/24 11:55:21 ceriel Exp $ */
3 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
4 * See the copyright notice in the ACK home directory, in the file "Copyright".
6 /* This file essentially describes how the mallink info block
10 #define MIN_SIZE (1<<LOG_MIN_SIZE)
11 #define MAX_FLIST (LOG_MAX_SIZE - LOG_MIN_SIZE)
12 #if ALIGNMENT != 4 && ALIGNMENT != 8 && ALIGNMENT != 16
13 #error ALIGNMENT must be 4, 8 or 16
14 #elif ALIGNMENT % _EM_LSIZE
15 /* since calloc() does it's initialization in longs */
16 #error ALIGNMENT must be a multiple of the long size
18 #define align(n) (((n) + (ALIGNMENT - 1)) & ~(ALIGNMENT - 1))
25 typedef union _inf mallink;
26 #define MAL_NULL ((mallink *)0)
28 /* Access macros; only these macros know where to find values.
29 They are also lvalues.
33 #else /* def NON_STANDARD */
35 #endif /* NON_STANDARD */
37 #define _log_prev_of(ml) ((ml)[-1+OFF_SET]).ptr
38 #define _log_next_of(ml) ((ml)[-2+OFF_SET]).ptr
39 #define _phys_prev_of(ml) ((ml)[-3+OFF_SET]).ptr
40 #define _this_size_of(ml) ((ml)[-4+OFF_SET]).ui
43 #else /* ifdef CHECK */
44 #define _checksum_of(ml) ((ml)[-5+OFF_SET]).ui
45 #define _print_of(ml) ((ml)[-6+OFF_SET]).ui
46 #define _mark_of(ml) ((ml)[-7+OFF_SET]).ui
50 #define mallink_size() (size_t) \
51 align((N_WORDS - OFF_SET) * sizeof (mallink))
54 #define set_mark(ml,e) (_mark_of(ml) = (e))
55 #define mark_of(ml) (_mark_of(ml))
57 #define set_checksum(ml,e) (_checksum_of(ml) = (e))
58 #define checksum_of(ml) (_checksum_of(ml))
61 #define new_mallink(ml) ( _log_prev_of(ml) = 0, \
62 _log_next_of(ml) = 0, \
63 _phys_prev_of(ml) = 0, \
64 _this_size_of(ml) = 0 )
66 #define block_of_mallink(ml) ((void *)ml)
67 #define mallink_of_block(addr) ((mallink *)addr)
70 #define publicdata extern
72 #define private static
73 #define privatedata static
74 #else /* def EXTERN */
75 #define private extern
80 public m_assert(const char *fn, int ln);
81 #define assert(b) (!(b) ? m_assert(__FILE__, __LINE__) : 0)
82 #else /* ndef ASSERT */