summaryrefslogtreecommitdiff
path: root/libguile/bytevectors.h
diff options
context:
space:
mode:
authorDaniel Llorens <daniel.llorens@bluewin.ch>2015-02-11 12:58:01 +0100
committerDaniel Llorens <daniel.llorens@bluewin.ch>2016-11-23 11:49:35 +0100
commit85ac9cce0aa0d50274377244cf73c8776fb36db6 (patch)
treedab37284c85fc1b2e5ade9a2cacdfa6d4d18176d /libguile/bytevectors.h
parent4e766795b2412f42a9c71441e6cc0b36d8a4c5dc (diff)
downloadguile-85ac9cce0aa0d50274377244cf73c8776fb36db6.tar.gz
Reuse SCM_BYTEVECTOR_TYPED_LENGTH in scm_array_get_handle
* libguile/bytevectors.h (SCM_BYTEVECTOR_TYPE_SIZE, SCM_BYTEVECTOR_TYPED_LENGTH): Moved from libguile/bytevectors.c. * libguile/array-handle.c (scm_array_get_handle): Reuse SCM_BYTEVECTOR_TYPED_LENGTH.
Diffstat (limited to 'libguile/bytevectors.h')
-rw-r--r--libguile/bytevectors.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/libguile/bytevectors.h b/libguile/bytevectors.h
index a5eeaea0c..af4ac1c34 100644
--- a/libguile/bytevectors.h
+++ b/libguile/bytevectors.h
@@ -129,6 +129,11 @@ SCM_API SCM scm_utf32_to_string (SCM, SCM);
#define SCM_BYTEVECTOR_CONTIGUOUS_P(_bv) \
(SCM_BYTEVECTOR_FLAGS (_bv) >> 8UL)
+#define SCM_BYTEVECTOR_TYPE_SIZE(var) \
+ (scm_i_array_element_type_sizes[SCM_BYTEVECTOR_ELEMENT_TYPE (var)]/8)
+#define SCM_BYTEVECTOR_TYPED_LENGTH(var) \
+ (SCM_BYTEVECTOR_LENGTH (var) / SCM_BYTEVECTOR_TYPE_SIZE (var))
+
/* Hint that is passed to `scm_gc_malloc ()' and friends. */
#define SCM_GC_BYTEVECTOR "bytevector"