Removed the notion of a "large" context. For simplicity, all contexts
[panda.git] / src / st-word-array.h
blob8f5c83e98740e8d36433baa0f0ab2bc0c8225f96
1 /*
2 * st-array.h
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
22 * THE SOFTWARE.
25 #ifndef __ST_WORD_ARRAY_H__
26 #define __ST_WORD_ARRAY_H__
28 #include <st-types.h>
29 #include <st-object.h>
31 #define ST_WORD_ARRAY(oop) ((struct st_word_array *) ST_POINTER (oop))
33 struct st_word_array
35 struct st_arrayed_object header;
37 st_uint elements[];
40 st_descriptor *st_word_array_descriptor (void);
42 static inline st_uint *
43 st_word_array_elements (st_oop object)
45 return ST_WORD_ARRAY (object)->elements;
48 static inline st_uint
49 st_word_array_at (st_oop object, st_smi i)
51 st_assert (1 <= i && i <= st_arrayed_object_size (object));
53 return ST_WORD_ARRAY (object)->elements[i - 1];
56 static inline void
57 st_word_array_at_put (st_oop object, st_smi i, st_uint value)
59 st_assert (1 <= i && i <= st_arrayed_object_size (object));
61 ST_WORD_ARRAY (object)->elements[i - 1] = value;
64 #endif /* __ST_WORD_ARRAY_H__ */