mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-13 04:42:13 -08:00
Support for _unsigned_ specialized arrays of type CL-INDEX (i.e. the smallest unsigned word that fits a fixnum)
This commit is contained in:
parent
31552cc918
commit
9ecbe76d8b
6 changed files with 35 additions and 3 deletions
|
|
@ -108,6 +108,9 @@ aref(cl_object x, cl_index index)
|
|||
case aet_fix:
|
||||
return make_integer(x->array.self.fix[index]);
|
||||
|
||||
case aet_index:
|
||||
return make_unsigned_integer(x->array.self.index[index]);
|
||||
|
||||
case aet_sf:
|
||||
return(make_shortfloat(x->array.self.sf[index]));
|
||||
|
||||
|
|
@ -211,7 +214,11 @@ aset(cl_object x, cl_index index, cl_object value)
|
|||
break;
|
||||
}
|
||||
case aet_fix:
|
||||
x->array.self.fix[index] = object_to_fixnum(value);
|
||||
x->array.self.fix[index] = fixint(value);
|
||||
break;
|
||||
|
||||
case aet_index:
|
||||
x->array.self.index[index] = fixnnint(value);
|
||||
break;
|
||||
|
||||
case aet_sf:
|
||||
|
|
@ -390,6 +397,14 @@ array_allocself(cl_object x)
|
|||
x->array.self.fix = elts;
|
||||
break;
|
||||
}
|
||||
case aet_index: {
|
||||
cl_fixnum *elts;
|
||||
elts = (cl_fixnum *)cl_alloc_atomic_align(sizeof(*elts)*d, sizeof(*elts));
|
||||
for (i = 0; i < d; i++)
|
||||
elts[i] = 0;
|
||||
x->array.self.fix = elts;
|
||||
break;
|
||||
}
|
||||
case aet_sf: {
|
||||
float *elts;
|
||||
elts = (float *)cl_alloc_atomic_align(sizeof(*elts)*d, sizeof(*elts));
|
||||
|
|
@ -436,6 +451,8 @@ ecl_symbol_to_elttype(cl_object x)
|
|||
return(aet_bit);
|
||||
else if (x == @'ext::cl-fixnum')
|
||||
return(aet_fix);
|
||||
else if (x == @'ext::cl-index')
|
||||
return(aet_index);
|
||||
else if (x == @'single-float' || x == @'short-float')
|
||||
return(aet_sf);
|
||||
else if (x == @'long-float' || x == @'double-float')
|
||||
|
|
@ -459,6 +476,7 @@ ecl_elttype_to_symbol(cl_elttype aet)
|
|||
case aet_ch: output = @'base-char'; break;
|
||||
case aet_bit: output = @'bit'; break;
|
||||
case aet_fix: output = @'ext::cl-fixnum'; break;
|
||||
case aet_index: output = @'ext::cl-index'; break;
|
||||
case aet_sf: output = @'short-float'; break;
|
||||
case aet_lf: output = @'long-float'; break;
|
||||
case aet_b8: output = @'ext::byte8'; break;
|
||||
|
|
@ -475,6 +493,8 @@ array_address(cl_object x, cl_index inc)
|
|||
return x->array.self.t + inc;
|
||||
case aet_fix:
|
||||
return x->array.self.fix + inc;
|
||||
case aet_index:
|
||||
return x->array.self.fix + inc;
|
||||
case aet_sf:
|
||||
return x->array.self.t + inc;
|
||||
case aet_ch:
|
||||
|
|
@ -679,6 +699,9 @@ cl_array_displacement(cl_object a)
|
|||
case aet_fix:
|
||||
offset = a->array.self.fix - to_array->array.self.fix;
|
||||
break;
|
||||
case aet_index:
|
||||
offset = a->array.self.fix - to_array->array.self.fix;
|
||||
break;
|
||||
case aet_sf:
|
||||
offset = a->array.self.sf - to_array->array.self.sf;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue