mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-19 19:20:23 +02:00
bytevector-slice: optimize trivial case
* libguile/bytevectors.c (scm_bytevector_slice): Return the bytevector directly if start==0 and count==len.
This commit is contained in:
parent
03344ce431
commit
67dbc60e8f
1 changed files with 3 additions and 0 deletions
|
@ -357,6 +357,9 @@ SCM_DEFINE (scm_bytevector_slice, "bytevector-slice", 2, 1, 0,
|
|||
else
|
||||
c_size = scm_to_size_t (size);
|
||||
|
||||
if (c_offset == 0 && c_size == SCM_BYTEVECTOR_LENGTH (bv))
|
||||
return bv;
|
||||
|
||||
if (INT_ADD_OVERFLOW (c_offset, c_size)
|
||||
|| (c_offset + c_size > SCM_BYTEVECTOR_LENGTH (bv)))
|
||||
scm_out_of_range (FUNC_NAME, offset);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue