1 /***********************************************************************/
5 /* Damien Doligez, projet Para, INRIA Rocquencourt */
7 /* Copyright 1996 Institut National de Recherche en Informatique et */
8 /* en Automatique. All rights reserved. This file is distributed */
9 /* under the terms of the GNU Library General Public License, with */
10 /* the special exception on linking described in file ../LICENSE. */
12 /***********************************************************************/
14 /* $Id: gc.h 6557 2004-07-19 13:20:06Z xleroy $ */
22 #define Caml_white (0 << 8)
23 #define Caml_gray (1 << 8)
24 #define Caml_blue (2 << 8)
25 #define Caml_black (3 << 8)
27 #define Color_hd(hd) ((color_t) ((hd) & Caml_black))
28 #define Color_hp(hp) (Color_hd (Hd_hp (hp)))
29 #define Color_val(val) (Color_hd (Hd_val (val)))
31 #define Is_white_hd(hd) (Color_hd (hd) == Caml_white)
32 #define Is_gray_hd(hd) (Color_hd (hd) == Caml_gray)
33 #define Is_blue_hd(hd) (Color_hd (hd) == Caml_blue)
34 #define Is_black_hd(hd) (Color_hd (hd) == Caml_black)
36 #define Whitehd_hd(hd) (((hd) & ~Caml_black)/*| Caml_white*/)
37 #define Grayhd_hd(hd) (((hd) & ~Caml_black) | Caml_gray)
38 #define Blackhd_hd(hd) (((hd)/*& ~Caml_black*/)| Caml_black)
39 #define Bluehd_hd(hd) (((hd) & ~Caml_black) | Caml_blue)
41 /* This depends on the layout of the header. See [mlvalues.h]. */
42 #define Make_header(wosize, tag, color) \
43 (/*Assert ((wosize) <= Max_wosize),*/ \
44 ((header_t) (((header_t) (wosize) << 10) \
49 #define Is_white_val(val) (Color_val(val) == Caml_white)
50 #define Is_gray_val(val) (Color_val(val) == Caml_gray)
51 #define Is_blue_val(val) (Color_val(val) == Caml_blue)
52 #define Is_black_val(val) (Color_val(val) == Caml_black)
55 #define Colornum_hd(hd) ((color_t) (((hd) >> 8) & 3))
56 #define Coloredhd_hd(hd,colnum) (((hd) & ~Caml_black) | ((colnum) << 8))
58 #endif /* CAML_GC_H */