Import Debian changes 20180207-1
[hcoop/debian/mlton.git] / runtime / gc / string.h
1 /* Copyright (C) 2012 Matthew Fluet.
2 * Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
3 * Jagannathan, and Stephen Weeks.
4 * Copyright (C) 1997-2000 NEC Research Institute.
5 *
6 * MLton is released under a BSD-style license.
7 * See the file MLton-LICENSE for details.
8 */
9
10 #if (defined (MLTON_GC_INTERNAL_TYPES))
11
12 /* Layout of strings.
13 * Note, the value passed around is a pointer to the obj member.
14 */
15 struct GC_string8_obj {
16 char chars[1];
17 };
18 typedef struct GC_string8 {
19 GC_arrayCounter counter;
20 GC_arrayLength length;
21 GC_header header;
22 struct GC_string8_obj obj;
23 } __attribute__ ((packed)) *GC_string8;
24
25 COMPILE_TIME_ASSERT(GC_string8__obj_packed,
26 offsetof(struct GC_string8, obj) ==
27 sizeof(GC_arrayCounter)
28 + sizeof(GC_arrayLength)
29 + sizeof(GC_header));
30 COMPILE_TIME_ASSERT(GC_string8_obj__chars_packed,
31 offsetof(struct GC_string8_obj, chars) ==
32 0);
33
34 #endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
35
36 #if (defined (MLTON_GC_INTERNAL_FUNCS))
37
38 #define GC_STRING8_HEADER GC_WORD8_VECTOR_HEADER
39
40 #endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */