yangtau/hedgehog

make capacity be the power of 2

Closed this issue · 1 comments

make capacity be the power of 2

arr->capacity = len; // TODO: make capacity be the power of 2

}

void value_array_init_with_values(struct value_array* arr, int len,
                                  const struct hg_value* values) {
    arr->len      = len;
    arr->capacity = len; // TODO: make capacity be the power of 2
    arr->values   = array_alloc_(struct hg_value, len);
    memcpy(arr->values, values, len * sizeof(struct hg_value));
}

void value_array_free(struct value_array* arr) {
    array_free_(arr->values, struct hg_value, arr->capacity);

ndex 66fe506..746c3f5 100644
++ b/src/value.h

e328efb8e9c5be82f3f2fa681c800092979c11a4