1 /* $Id: impl.h,v 1.11 1994/06/24 11:17:49 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 ALIGNMENT must be 4, 8, or 16
15 #if MIN_SIZE % ALIGNMENT
16 ALIGNMENT must be a dividor of MIN_SIZE
19 #define LOG_ALIGNMENT 2
22 #define LOG_ALIGNMENT 3
25 #define LOG_ALIGNMENT 4
27 #define align(n) (((n) + (ALIGNMENT - 1)) & ~(ALIGNMENT - 1))
34 typedef union _inf mallink;
35 #define MAL_NULL ((mallink *)0)
37 /* Access macros; only these macros know where to find values.
38 They are also lvalues.
42 #else /* def NON_STANDARD */
44 #endif /* NON_STANDARD */
46 #define _log_prev_of(ml) ((ml)[-1+OFF_SET]).ptr
47 #define _log_next_of(ml) ((ml)[-2+OFF_SET]).ptr
48 #define _phys_prev_of(ml) ((ml)[-3+OFF_SET]).ptr
49 #define _this_size_of(ml) ((ml)[-4+OFF_SET]).ui
52 #else /* ifdef CHECK */
53 #define _checksum_of(ml) ((ml)[-5+OFF_SET]).ui
54 #define _print_of(ml) ((ml)[-6+OFF_SET]).ui
55 #define _mark_of(ml) ((ml)[-7+OFF_SET]).ui
59 #define mallink_size() (unsigned int) \
60 align((N_WORDS - OFF_SET) * sizeof (mallink))
63 #define set_mark(ml,e) (_mark_of(ml) = (e))
64 #define mark_of(ml) (_mark_of(ml))
66 #define set_checksum(ml,e) (_checksum_of(ml) = (e))
67 #define checksum_of(ml) (_checksum_of(ml))
70 #define new_mallink(ml) ( _log_prev_of(ml) = 0, \
71 _log_next_of(ml) = 0, \
72 _phys_prev_of(ml) = 0, \
73 _this_size_of(ml) = 0 )
75 #define block_of_mallink(ml) ((char *)ml)
76 #define mallink_of_block(addr) ((mallink *)addr)
79 #define publicdata extern
81 #define private static
82 #define privatedata static
83 #else /* def EXTERN */
84 #define private extern
90 #define assert(b) (!(b) ? m_assert(__FILE__, __LINE__) : 0)
91 #else /* ndef ASSERT */