GFG / bloom-filter

RocketLabsBloomFilter by Ulf Kirsten
https://www.rocket-internet.de
MIT License
19 stars 4 forks source link

Feature request to add size parameter to BitString constructor #9

Open whus6207 opened 6 years ago

whus6207 commented 6 years ago

The current constructor of BitString is forced to use DEFAULT_BYTE_SIZE, which does not always match people's need. It'd be nice and simple to allow initialization with customized size:

/**
 * @param int $size
 */
public function __construct(int size=self::DEFAULT_BYTE_SIZE)
{
    $this->size = $size;
    $this->bytes = str_repeat(chr(0), $this->size);
}

Currently I'm forced to create an all-zeros string myself, and call createFromString, which is not very ideal