1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; indent-offset: 4 -*- */
5 * Copyright (C) 2008 Vincent Geddes <vgeddes@gnome.org>
7 * This library is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation, either
10 * version 3 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef _ST_FLOAT_ARRAY_H__
22 #define _ST_FLOAT_ARRAY_H__
24 #include <st-heap-object.h>
26 #include <st-vtable.h>
32 st_oop_t size
double elements
[];
36 INLINE st_smi_t
st_float_array_size (st_oop_t array
);
38 INLINE
bool st_float_array_range_check (st_oop_t array
, st_smi_t i
);
40 INLINE
double st_float_array_at (st_oop_t array
, st_smi_t i
);
42 INLINE
void st_float_array_at_put (st_oop_t array
, st_smi_t i
, double value
);
44 st_vtable_t
*st_float_array_table (void);
47 /* inline definitions */
48 #define ST_FLOAT_ARRAY(oop) ((st_float_array_t *) ST_POINTER (oop))
51 st_float_array_size (st_oop_t array
)
53 return ST_FLOAT_ARRAY (array
)->size
;
57 st_float_array_range_check (st_oop_t array
, st_smi_t i
)
59 return 1 <= i
&& <=st_smi_value (st_float_array_size (array
));
63 st_float_array_at (st_oop_t array
, st_smi_t i
)
65 return ST_FLOAT_ARRAY (array
)->elements
[i
- 1];
69 st_float_array_at_put (st_oop_t array
, st_smi_t i
, double value
)
71 return ST_FLOAT_ARRAY (array
)->elements
[i
- 1] = value
;
75 #endif /* _ST_FLOAT_ARRAY_H__ */