Skip to content

Feature request to add size parameter to BitString constructor #9

Description

@whus6207

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions