File: memory.h

package info (click to toggle)
scheme48 1.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 14,980 kB
  • ctags: 14,127
  • sloc: lisp: 76,272; ansic: 71,514; sh: 3,026; makefile: 637
file content (32 lines) | stat: -rw-r--r-- 1,190 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* Copyright (c) 1993-2008 by Richard Kelsey and Jonathan Rees.
   See file COPYING. */

#ifndef __S48_GC_MEMORY_H
#define __S48_GC_MEMORY_H

typedef char* s48_address;

/* bytes <--> cells */
/* can't include scheme48.h, because of mutual inclusion: defines S48_LOG_BYTES_PER_CELL */
#define S48_BYTES_PER_CELL (1L << S48_LOG_BYTES_PER_CELL)

#define S48_BYTES_TO_CELLS(b) (((unsigned long)(b + (S48_BYTES_PER_CELL - 1))) \
  >> S48_LOG_BYTES_PER_CELL)

#define S48_CELLS_TO_BYTES(c) ((c) << S48_LOG_BYTES_PER_CELL)

/* addressable units <--> cells */
#define S48_LOG_A_UNITS_PER_CELL S48_LOG_BYTES_PER_CELL /* on byte-addressable platforms (the only ones we support at the moment) */
#define S48_A_UNITS_PER_CELL (1L << S48_LOG_A_UNITS_PER_CELL)

#define S48_A_UNITS_TO_CELLS(a) (((unsigned long)a) >> S48_LOG_A_UNITS_PER_CELL)
#define S48_CELLS_TO_A_UNITS(c) ((c) << S48_LOG_A_UNITS_PER_CELL)

/* addressable units <--> bytes */
#define S48_BYTES_TO_A_UNITS(b) S48_CELLS_TO_A_UNITS(S48_BYTES_TO_CELLS(b))
#define S48_A_UNITS_TO_BYTES(a) S48_CELLS_TO_BYTES(S48_A_UNITS_TO_CELLS(a))

/* address1+ */
#define S48_ADDRESS_INC(address) ((s48_address)(address + S48_A_UNITS_PER_CELL))

#endif