mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-19 05:39:17 +02:00
Unsafe vector-set
This commit is contained in:
parent
a3c63632a3
commit
0651716196
3 changed files with 14 additions and 1 deletions
|
@ -489,6 +489,7 @@ object Cyc_vector_ref(void *d, object v, object k);
|
|||
#define Cyc_vector_ref_unsafe(d, v, k) \
|
||||
((vector) v)->elements[obj_obj2int(k)]
|
||||
object Cyc_vector_set(void *d, object v, object k, object obj);
|
||||
object Cyc_vector_set_unsafe(void *d, object v, object k, object obj);
|
||||
object Cyc_make_vector(void *data, object cont, int argc, object len, ...);
|
||||
/**@}*/
|
||||
|
||||
|
|
|
@ -1939,6 +1939,15 @@ object Cyc_vector_set(void *data, object v, object k, object obj)
|
|||
return v;
|
||||
}
|
||||
|
||||
object Cyc_vector_set_unsafe(void *data, object v, object k, object obj)
|
||||
{
|
||||
int idx = unbox_number(k);
|
||||
gc_mut_update((gc_thread_data *) data, ((vector) v)->elements[idx], obj);
|
||||
((vector) v)->elements[idx] = obj;
|
||||
add_mutation(data, v, idx, obj);
|
||||
return v;
|
||||
}
|
||||
|
||||
object Cyc_vector_ref(void *data, object v, object k)
|
||||
{
|
||||
int idx;
|
||||
|
|
|
@ -629,7 +629,10 @@
|
|||
(if emit-unsafe
|
||||
"Cyc_vector_ref_unsafe"
|
||||
"Cyc_vector_ref"))
|
||||
((eq? p 'vector-set!) "Cyc_vector_set")
|
||||
((eq? p 'vector-set!)
|
||||
(if emit-unsafe
|
||||
"Cyc_vector_set_unsafe"
|
||||
"Cyc_vector_set"))
|
||||
((eq? p 'string-append) "Cyc_string_append")
|
||||
((eq? p 'string-cmp) "Cyc_string_cmp")
|
||||
((eq? p 'string->symbol) "Cyc_string2symbol")
|
||||
|
|
Loading…
Add table
Reference in a new issue