Skip to content

PHP implementation #4

@mpskovvang

Description

@mpskovvang

I've attempted to port your great work to the PHP language: northlands-io/permuteseq

Unfortunately, PHP doesn't support unsigned integers. My knowledge of bitwise operations and shifting is limited, and therefore I'm unsure of the consequences of my signed integers implementation.

I've compared the output with your extension, and (with a modified key scrambling) the results are identical and my tests are passing, but I'm still concerned about integer overflow in edge cases.

Especially these lines, where you're explicit casting to uint64:
https://github.com/northlands-io/permuteseq/blob/33a646f17a680c3589f89f7bdef7e39761548597/src/Permuteseq.php#L48
https://github.com/northlands-io/permuteseq/blob/33a646f17a680c3589f89f7bdef7e39761548597/src/Permuteseq.php#L94
https://github.com/northlands-io/permuteseq/blob/33a646f17a680c3589f89f7bdef7e39761548597/src/Permuteseq.php#L134

I would be very grateful if you could do a short code review.

Thanks,

Martin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions