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

XOR in snpsortit() of mcio.c #91

Open
ntakebay opened this issue Aug 3, 2023 · 0 comments
Open

XOR in snpsortit() of mcio.c #91

ntakebay opened this issue Aug 3, 2023 · 0 comments

Comments

@ntakebay
Copy link

ntakebay commented Aug 3, 2023

In this function, base[1] is assigned to 10^8, which is equal to 2, and the array base is simply (1,2,3). This causes the gcc (mine is version 13.2.1) to give the following warnings (to warn the programmer to make sure he/she doesn't accidentally use ^ to mean power instead of XOR). I noticed that this function snpsortit() is commented out, and not used any more, so it doesn't influence anything. But it might be nicer to clean it up by removing the function or change it to base[1]=2 and base[2]=3.

cc -I../include -I/usr/include/openblas -c -o mcio.o mcio.c
mcio.c: In function ‘snpsortit’:
mcio.c:119:16: warning: result of ‘10^8’ is 2; did you mean ‘1e8’? [-Wxor-used-as-pow]
119 | base[1] = 10 ^ 8;
| ^
| --
| 1 e
mcio.c:119:13: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
119 | base[1] = 10 ^ 8;
| ^~
| 0xa
mcio.c:120:16: warning: result of ‘10^9’ is 3; did you mean ‘1e9’? [-Wxor-used-as-pow]
120 | base[2] = 10 ^ 9;
| ^
| --
| 1 e
mcio.c:120:13: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
120 | base[2] = 10 ^ 9;
| ^~
| 0xa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant