Skip to content
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

__quantum__rt__bigint_shift{left,right}: Consider adding details #29

Open
kuzminrobin opened this issue Sep 15, 2022 · 1 comment
Open
Labels
documentation Improvements or additions to documentation

Comments

@kuzminrobin
Copy link

kuzminrobin commented Sep 15, 2022

The doc for
__quantum__rt__bigint_shiftleft and
__quantum__rt__bigint_shiftright says:
"Returns the big integer arithmetically shifted .. by the (positive) integer amount of bits."
The doc does not say what will happen if the amount of bits (the second parameter) is negative.

Consider making the second param an unsigned type (u8 can be sufficient), such that the questions, like the one above, do not arise.

Also the fragment "(positive) integer amount of bits" tells me that the amount of bits (the second parameter) can not be zero. At least in Russian-language mathematics the word "positive" means "greater than zero", and the concept of "zero or greater" is expressed with the words "non-negative".
If the amount of bits (the second parameter):
can be zero then consider replacing the fragment "(positive)" with "(non-negative)" or "(zero or greater)";
cannot be zero then consider replacing the fragment "(positive)" with "(greater than zero)".

@swernli
Copy link
Contributor

swernli commented Sep 15, 2022

Unfortunately there is no unsigned type in LLVM, since integers are just bits that are treated as signed or unsigned by the operation they are passed to. As such, there is no u8 type and instead it would be up to the documentation on the function to specify that the integer is interpreted as unsigned.

@bettinaheim bettinaheim added the documentation Improvements or additions to documentation label Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants