unread
Hello Xinchen,
Thanks for changing array_pad and array_rand accordingly, that's very good.
I noticed a small improvement we could make to array_slice for the packed case:
We can change line 3003:
if ((Z_ARRVAL_P(input)->u.flags & HASH_FLAG_PACKED) && !preserve_keys)
=>
if ((Z_ARRVAL_P(input)->u.flags & HASH_FLAG_PACKED) && (!preserve_keys || offset == 0))
So whenever the input array is packed, we can of course safely use a packed array for the output array when preserve_keys is false, but also when preserve_keys is true and if (only if) the offset is zero, because offset=0 on a packed array will yield the same result no matter whether preserved_keys is true or false.
Ben