diff options
author | Marius Vollmer <mvo@zagadka.de> | 2005-01-09 22:02:40 +0000 |
---|---|---|
committer | Marius Vollmer <mvo@zagadka.de> | 2005-01-09 22:02:40 +0000 |
commit | 9598a4060a558e70675ac3321597b68d914c6148 (patch) | |
tree | 938ef05b6cd8adaae6ba246af3f3e4193e950be8 /libguile/inline.h | |
parent | 8c8491f56c25d3d385099b0b0f692b402783e2e8 (diff) | |
download | guile-9598a4060a558e70675ac3321597b68d914c6148.tar.gz |
* unif.h, unif.c, inline.h (scm_i_t_array_ref, scm_i_t_array_set):
New.
(scm_t_array_handle): Added ref, set, elements and
writable_elements for fast inline operation of
scm_array_handle_ref and scm_array_handle_set.
(scm_array_handle_ref, scm_array_handle_set): Moved to inline.h
and replaced with inline code that simply calls the ref/set
members of the handle.
(enclosed_ref, vector_ref, string_ref, bitvector_ref, memoize_ref,
enclosed_set, vector_set, string_set, bitvector_set, memoize_set):
New.
(scm_array_handle_get): Initialize ref/set fields to memoize_ref
and memoize_set.
(scm_bitvector_fill_x, scm_bitvector_to_list, scm_bit_count,
scm_bit_position, scm_bit_set_star_x, scm_bit_count_star,
scm_bit_invert_x): Correctly multiply index with increment in the
general case.
* unif.c (scm_array_handle_set): Correctly execute only one
alternative. D'Oh!
(scm_list_to_typed_array, l2ra): Use scm_t_array_handle to fill
the array; this covers all cases with much simpler code.
Diffstat (limited to 'libguile/inline.h')
-rw-r--r-- | libguile/inline.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libguile/inline.h b/libguile/inline.h index 703e1c6de..823ddc4fb 100644 --- a/libguile/inline.h +++ b/libguile/inline.h @@ -34,12 +34,15 @@ #include "libguile/pairs.h" #include "libguile/gc.h" #include "libguile/threads.h" +#include "libguile/unif.h" SCM_API SCM scm_cell (scm_t_bits car, scm_t_bits cdr); SCM_API SCM scm_double_cell (scm_t_bits car, scm_t_bits cbr, scm_t_bits ccr, scm_t_bits cdr); +SCM_API SCM scm_array_handle_ref (scm_t_array_handle *h, ssize_t pos); +SCM_API void scm_array_handle_set (scm_t_array_handle *h, ssize_t pos, SCM val); #if defined SCM_C_INLINE || defined SCM_INLINE_C_INCLUDING_INLINE_H @@ -246,7 +249,35 @@ scm_double_cell (scm_t_bits car, scm_t_bits cbr, return z; } +#if defined SCM_C_INLINE && ! defined SCM_INLINE_C_INCLUDING_INLINE_H +/* definitely inlining */ +#ifdef __GNUC__ +extern +#else +static +#endif +SCM_C_INLINE +#endif +SCM +scm_array_handle_ref (scm_t_array_handle *h, ssize_t p) +{ + return h->ref (h, p); +} +#if defined SCM_C_INLINE && ! defined SCM_INLINE_C_INCLUDING_INLINE_H +/* definitely inlining */ +#ifdef __GNUC__ +extern +#else +static +#endif +SCM_C_INLINE +#endif +void +scm_array_handle_set (scm_t_array_handle *h, ssize_t p, SCM v) +{ + h->set (h, p, v); +} #endif #endif |