4 * Copyright (C) 2008 Vincent Geddes
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 #ifndef __ST_TYPES_H__
26 #define __ST_TYPES_H__
33 /* Check host data model. We only support LP64 at the moment.
35 #if (SIZEOF_VOID_P == 4 && SIZEOF_INT == 4)
38 # define ST_BITS_PER_WORD 32
39 # define ST_BITS_PER_INTEGER 32
40 #elif (SIZEOF_VOID_P == 8)
43 # define ST_BITS_PER_WORD 64
44 # define ST_BITS_PER_INTEGER 32
46 # error Sorry, platform not supported. Patches welcome!
49 #define ST_SMALL_INTEGER_MIN (-ST_SMALL_INTEGER_MAX - 1)
50 #define ST_SMALL_INTEGER_MAX 536870911
62 * integral type wide enough to hold a C pointer.
63 * Can either point to a heap object or contain a smi or Character immediate.
65 typedef uintptr_t st_oop
;
67 typedef unsigned char st_uchar
;
68 typedef unsigned short st_ushort
;
69 typedef unsigned long st_ulong
;
70 typedef unsigned int st_uint
;
71 typedef void * st_pointer
;
72 typedef st_uint st_unichar
;
75 st_tag_pointer (st_pointer p
)
77 return ((st_oop
) p
) + ST_POINTER_TAG
;
80 static inline st_oop
*
81 st_detag_pointer (st_oop oop
)
83 return (st_oop
*) (oop
- ST_POINTER_TAG
);
86 #endif /* __ST_TYPES_H__ */