DReichLab / DReichLab/EIG

XOR in snpsortit() of mcio.c

Open
#91 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
207
Forks
61
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open mcio.c and inspect the commented-out snpsortit() function and its base assignments. Confirm whether the function is referenced, then either remove it or replace the misleading expressions with the intended constants. Rebuild with the reported cc command and verify that the XOR-as-power warnings are gone.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
tooling
Issue type
Refactor
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.