summaryrefslogtreecommitdiff
path: root/libguile/bytevectors.h
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2009-08-31 01:07:30 +0200
committerLudovic Courtès <ludo@gnu.org>2009-08-31 01:07:30 +0200
commit0665b3ffcb7ec5232a51ff632a818a638dfd4054 (patch)
treec94dabe676d21744f107b83b114832c7d5a158fa /libguile/bytevectors.h
parent807e5a6641b2aa37ce4198a6c13f1aaebd3a5f25 (diff)
downloadguile-0665b3ffcb7ec5232a51ff632a818a638dfd4054.tar.gz
Remove the distinction between inline/outline storage for bytevectors.
* libguile/bytevectors.c (SCM_BYTEVECTOR_INLINE_THRESHOLD, SCM_BYTEVECTOR_INLINEABLE_SIZE_P, SCM_BYTEVECTOR_SET_CONTENTS, SCM_BYTEVECTOR_SET_INLINE): Remove. (SCM_BYTEVECTOR_HEADER_BYTES): New macro. (SCM_BYTEVECTOR_SET_ELEMENT_TYPE): Adjust to new flag layout. (make_bytevector): Remove content inlining machinery; use `scm_gc_malloc_pointerless ()' in all cases; special-case zero-sized vu8 buffers. (make_bytevector_from_buffer): Simplified. (scm_c_shrink_bytevector): New, formerly `scm_i_shrink_bytevector ()'. Remove buffer inlining machinery. (scm_bootstrap_bytevectors): Use `make_bytevector ()' for SCM_NULL_BYTEVECTOR. * libguile/bytevectors.h (SCM_BYTEVECTOR_HEADER_SIZE): New macro. (SCM_BYTEVECTOR_CONTENTS): Adjust to new layout. (SCM_SET_BYTEVECTOR_FLAGS): Properly cast F. (SCM_F_BYTEVECTOR_INLINE, SCM_BYTEVECTOR_INLINE_P): Remove. (SCM_BYTEVECTOR_ELEMENT_TYPE): Adjust. (scm_c_shrink_bytevector): Remove macro, make a C function declaration.
Diffstat (limited to 'libguile/bytevectors.h')
-rw-r--r--libguile/bytevectors.h29
1 files changed, 12 insertions, 17 deletions
diff --git a/libguile/bytevectors.h b/libguile/bytevectors.h
index e3296500f..506312638 100644
--- a/libguile/bytevectors.h
+++ b/libguile/bytevectors.h
@@ -26,12 +26,15 @@
/* R6RS bytevectors. */
+/* The size in words of the bytevector header (type tag, flags, and
+ length). */
+#define SCM_BYTEVECTOR_HEADER_SIZE 2U
+
#define SCM_BYTEVECTOR_LENGTH(_bv) \
((size_t) SCM_CELL_WORD_1 (_bv))
-#define SCM_BYTEVECTOR_CONTENTS(_bv) \
- (SCM_BYTEVECTOR_INLINE_P (_bv) \
- ? (signed char *) SCM_CELL_OBJECT_LOC ((_bv), 2) \
- : (signed char *) SCM_CELL_WORD_2 (_bv))
+#define SCM_BYTEVECTOR_CONTENTS(_bv) \
+ ((signed char *) SCM_CELL_OBJECT_LOC ((_bv), \
+ SCM_BYTEVECTOR_HEADER_SIZE))
SCM_API SCM scm_endianness_big;
@@ -116,14 +119,12 @@ SCM_API SCM scm_utf32_to_string (SCM, SCM);
(!SCM_IMP (x) && SCM_TYP7(x) == scm_tc7_bytevector)
#define SCM_BYTEVECTOR_FLAGS(_bv) \
(SCM_CELL_TYPE (_bv) >> 7UL)
-#define SCM_SET_BYTEVECTOR_FLAGS(_bv, _f) \
- SCM_SET_CELL_TYPE ((_bv), scm_tc7_bytevector | ((_f) << 7UL))
+#define SCM_SET_BYTEVECTOR_FLAGS(_bv, _f) \
+ SCM_SET_CELL_TYPE ((_bv), \
+ scm_tc7_bytevector | ((scm_t_bits)(_f) << 7UL))
-#define SCM_F_BYTEVECTOR_INLINE 0x1
-#define SCM_BYTEVECTOR_INLINE_P(_bv) \
- (SCM_BYTEVECTOR_FLAGS (_bv) & SCM_F_BYTEVECTOR_INLINE)
#define SCM_BYTEVECTOR_ELEMENT_TYPE(_bv) \
- (SCM_BYTEVECTOR_FLAGS (_bv) >> 1UL)
+ (SCM_BYTEVECTOR_FLAGS (_bv))
/* Hint that is passed to `scm_gc_malloc ()' and friends. */
#define SCM_GC_BYTEVECTOR "bytevector"
@@ -140,13 +141,7 @@ SCM_INTERNAL SCM scm_c_take_bytevector (signed char *, size_t);
SCM_INTERNAL int scm_i_print_bytevector (SCM, SCM, scm_print_state *);
-
-#define scm_c_shrink_bytevector(_bv, _len) \
- (SCM_BYTEVECTOR_INLINE_P (_bv) \
- ? (_bv) \
- : scm_i_shrink_bytevector ((_bv), (_len)))
-
-SCM_INTERNAL SCM scm_i_shrink_bytevector (SCM, size_t);
+SCM_INTERNAL SCM scm_c_shrink_bytevector (SCM, size_t);
SCM_INTERNAL void scm_i_bytevector_generalized_set_x (SCM, size_t, SCM);
SCM_INTERNAL SCM scm_null_bytevector;