mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-05-03 22:40:41 -07:00
Better calculation of buffer size in safe_buffer_pointer
This commit is contained in:
parent
7d68d65331
commit
61c183c5da
2 changed files with 6 additions and 5 deletions
|
|
@ -437,14 +437,15 @@ safe_buffer_pointer(cl_object x, cl_index size)
|
|||
cl_type t = type_of(x);
|
||||
int ok = 0;
|
||||
if (t == t_base_string) {
|
||||
ok = (size < x->base_string.dim);
|
||||
ok = (size <= x->base_string.dim);
|
||||
} else if (t == t_vector) {
|
||||
cl_elttype aet = (cl_elttype)x->vector.elttype;
|
||||
if (aet == aet_b8 || aet == aet_i8 || aet == aet_bc) {
|
||||
ok = (size < x->vector.dim);
|
||||
ok = (size <= x->vector.dim);
|
||||
} else if (aet == aet_fix || aet == aet_index) {
|
||||
size /= sizeof(cl_index);
|
||||
ok = (size < x->vector.dim);
|
||||
cl_index divisor = sizeof(cl_index);
|
||||
size = (size + divisor - 1) / divisor;
|
||||
ok = (size <= x->vector.dim);
|
||||
}
|
||||
}
|
||||
if (!ok) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Returns, as a string, the location of the machine on which ECL runs."
|
|||
(defun lisp-implementation-version ()
|
||||
"Args:()
|
||||
Returns the version of your ECL as a string."
|
||||
"@PACKAGE_VERSION@ (CVS 2007-10-13 11:40)")
|
||||
"@PACKAGE_VERSION@ (CVS 2007-10-13 13:24)")
|
||||
|
||||
(defun machine-type ()
|
||||
"Args: ()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue