-
Notifications
You must be signed in to change notification settings - Fork 11
Add shift and bitwise operations #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add shift and bitwise operations #31
Conversation
|
I'm not sure how to add support for logical operations, one workaround may be: prog.set(k, ast.BinaryExpression(op=ast.BinaryOperator["&&"], lhs=ast.Identifier(i), rhs=ast.Identifier(j))) Another possibility is something like: def __and__(self, other: AstConvertible) -> OQPyBinaryExpression:
if _is_bool_type(self) or _is_bool_type(other):
return self._to_binary("&&", self, other)
return self._to_binary("&", self, other) |
I think based on the existing patterns for "non-overloadable syntax" (e.g.
|
2fe8f4d
to
5be0aa8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, LGTM! Any comments @jcjaskula-aws?
* Fix code of conduct link (openqasm#27) Co-authored-by: Jean-Christophe Jaskula <[email protected]> * Add support for arrays (openqasm#28) * Add array variable * Enable indexing * Add a test * More tests * Allow specifying type and dimensions in declaration * Explicitly test setting with variable * Typing: allow assignment to indexed expressions * Union type typealias * Fix comment, provide OQIndexExpression from the module * Pydocstyle Why complain now? * Add base type to ComplexVar and propagate it to arrays * Bump setuptools from 65.4.1 to 65.5.1 (openqasm#30) Bumps [setuptools](https://github.com/pypa/setuptools) from 65.4.1 to 65.5.1. - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/CHANGES.rst) - [Commits](pypa/setuptools@v65.4.1...v65.5.1) --- updated-dependencies: - dependency-name: setuptools dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump cryptography from 37.0.4 to 39.0.1 (openqasm#29) Bumps [cryptography](https://github.com/pyca/cryptography) from 37.0.4 to 39.0.1. - [Release notes](https://github.com/pyca/cryptography/releases) - [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst) - [Commits](pyca/cryptography@37.0.4...39.0.1) --- updated-dependencies: - dependency-name: cryptography dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add shift and bitwise operations (openqasm#31) * Add shift and logical operations * Add logical OR and AND --------- Co-authored-by: Mitch D'Ewart <[email protected]> --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Anurag Mishra <[email protected]> Co-authored-by: Jean-Christophe Jaskula <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: jmdewart <[email protected]> Co-authored-by: Mitch D'Ewart <[email protected]>
The PR adds support for classical shift and bitwise operations.