]> gitweb.factorcode.org Git - factor.git/blob - core/layouts/layouts.factor
Initial import
[factor.git] / core / layouts / layouts.factor
1 ! Copyright (C) 2007 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: namespaces math words kernel assocs system classes ;
4 IN: layouts
5
6 SYMBOL: tag-mask
7
8 SYMBOL: num-tags
9
10 SYMBOL: tag-bits
11
12 SYMBOL: num-types
13
14 SYMBOL: tag-numbers
15
16 SYMBOL: type-numbers
17
18 : tag-number ( class -- n )
19     tag-numbers get at [ object tag-number ] unless* ;
20
21 : type-number ( class -- n )
22     type-numbers get at ;
23
24 : tag-header ( n -- tagged )
25     tag-bits get shift ;
26
27 : first-bignum ( -- n )
28     bootstrap-cell-bits tag-bits get - 1 - 2^ ;
29
30 : most-positive-fixnum ( -- n )
31     first-bignum 1- ;
32
33 : most-negative-fixnum ( -- n )
34     first-bignum neg ;