diff options
Diffstat (limited to 'libguile/struct.c')
-rw-r--r-- | libguile/struct.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libguile/struct.c b/libguile/struct.c index c8d34a4db..2d36303b4 100644 --- a/libguile/struct.c +++ b/libguile/struct.c @@ -659,7 +659,11 @@ SCM_DEFINE (scm_struct_ref, "struct-ref", 2, 0, 0, fields_desc = scm_i_symbol_chars (layout); layout_len = scm_i_symbol_length (layout); - n_fields = data[scm_struct_i_n_words]; + if (SCM_STRUCT_VTABLE_FLAGS (handle) & SCM_STRUCTF_LIGHT) + /* no extra words */ + n_fields = layout_len / 2; + else + n_fields = data[scm_struct_i_n_words]; SCM_ASSERT_RANGE(1, pos, p < n_fields); @@ -736,7 +740,11 @@ SCM_DEFINE (scm_struct_set_x, "struct-set!", 3, 0, 0, fields_desc = scm_i_symbol_chars (layout); layout_len = scm_i_symbol_length (layout); - n_fields = data[scm_struct_i_n_words]; + if (SCM_STRUCT_VTABLE_FLAGS (handle) & SCM_STRUCTF_LIGHT) + /* no extra words */ + n_fields = layout_len / 2; + else + n_fields = data[scm_struct_i_n_words]; SCM_ASSERT_RANGE (1, pos, p < n_fields); |