murilo.wordpress.com
Deeper look at PHP’s array: worst case | Murilo :P
https://murilo.wordpress.com/2013/10/16/deeper-look-at-phps-array-worst-case
C , Computação, Programação, Web e afins :). Deeper look at PHP’s array: worst case. As I did in the post about the PHP sort functions. I was looking at the PHP source. I found this an interesting thing: the hashing function used on PHP’s hash tables. Above the function definition, a PHP contributor explained the function. This is Daniel J. Bernstein’s popular `times 33′ hash function as posted by him years ago on comp.lang.c. It basically uses a function like. Hash(i) hash(i-1) * 33 str[i]. Define(ARRAY...
murilo.wordpress.com
Arrays with negative indexes | Murilo :P
https://murilo.wordpress.com/2012/10/29/arrays-with-negative-indexes
C , Computação, Programação, Web e afins :). Arrays with negative indexes. When we to deal with negative ranges in arrays and those ranges can be negative, we do shifts so we can use natural indexes. For example, if we’re given a range from. Usually we allocate an array of 70 positions and when indexing an element we shift by. Is actually stored on the position. Where the array’s first element is in. Template typename T T* alloc(size t sz, int min index = 0) { return (new T[sz]) - min index; }. Fill in y...