1 /* Copyright (C) 1995,1996,1997,1998,2000,2001,2002,2003,2004, 2005, 2006, 2009, 2010, 2013, 2014 Free Software Foundation, Inc.
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public License
5 * as published by the Free Software Foundation; either version 3 of
6 * the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 #include "libguile/_scm.h"
27 #include "libguile/__scm.h"
29 #include "libguile/uniform.h"
32 const size_t scm_i_array_element_type_sizes
[SCM_ARRAY_ELEMENT_TYPE_LAST
+ 1] = {
46 scm_array_handle_uniform_element_size (scm_t_array_handle
*h
)
48 size_t ret
= scm_i_array_element_type_sizes
[h
->element_type
];
49 if (ret
&& ret
% 8 == 0)
52 scm_wrong_type_arg_msg (NULL
, 0, h
->array
, "byte-aligned uniform array");
54 scm_wrong_type_arg_msg (NULL
, 0, h
->array
, "uniform array");
58 scm_array_handle_uniform_element_bit_size (scm_t_array_handle
*h
)
60 size_t ret
= scm_i_array_element_type_sizes
[h
->element_type
];
64 scm_wrong_type_arg_msg (NULL
, 0, h
->array
, "uniform array");
68 scm_array_handle_uniform_elements (scm_t_array_handle
*h
)
70 return scm_array_handle_uniform_writable_elements (h
);
74 scm_array_handle_uniform_writable_elements (scm_t_array_handle
*h
)
79 esize
= scm_array_handle_uniform_element_size (h
);
80 ret
= ((scm_t_uint8
*) h
->writable_elements
) + h
->base
* esize
;
85 scm_init_uniform (void)
87 #include "libguile/uniform.x"