optimize access to arrays of rank 1 or 2
authorAndy Wingo <wingo@pobox.com>
Mon, 18 Feb 2013 15:38:24 +0000 (16:38 +0100)
committerAndy Wingo <wingo@pobox.com>
Mon, 18 Feb 2013 15:38:24 +0000 (16:38 +0100)
commit336c921146957a7416bc1717289a01f1b556ad82
treea06277914da095c42005622e45997d5ae8b3b3a4
parent18cd9aff9429c99ffae34448507f9b468e20e06f
optimize access to arrays of rank 1 or 2

* libguile/array-handle.c (scm_array_handle_pos_1):
  (scm_array_handle_pos_2): New functions.

* libguile/generalized-arrays.c (scm_c_array_ref_1, scm_c_array_ref_2):
  (scm_c_array_set_1_x, scm_c_array_set_2_x): New functions.
  (scm_i_array_ref, scm_i_array_set_x): New subr bindings for array-ref
  and array-set! that avoid consing for arrays of rank 1 or 2.

* test-suite/tests/arrays.test ("array-set!"): Fix expected exception
  for wrong number of indices.
libguile/array-handle.c
libguile/array-handle.h
libguile/generalized-arrays.c
libguile/generalized-arrays.h
test-suite/tests/arrays.test