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

[BUG] oRSF output operator does bitwise copy for ints into float buffer #265

Open
kzhuang1 opened this issue Mar 29, 2022 · 0 comments
Open
Assignees
Labels

Comments

@kzhuang1
Copy link

🐛 Bug report

Description of the bug

When using the << operator to output to oRSF class, an int array will be bitwise copied into the float buffer turning a 1 into 1.401e-45 in the output file.

To Reproduce

Steps to reproduce the behavior:

  1. create oRSF object e.g. "oRSF outmask("mask.rsf");"
  2. have int type array filled with int values like 1s and 0s e.g. "std::vector<int> mMask(myNk);"
  3. send int type array to oRSF object using operator << e.g. "outmask << (kernel->mMask);"
  4. See error in output file where 1s (and probably all other values are incorrect), e.g. sfdisfil < mask.rsf

Expected behavior

output should be 0s and 1s for mask

Additional context

Most likely cause is just an template that takes any class as input and uses a bitwise memcpy for output in the oRSF class, most likely needs an overload operator that uses proper type conversion rather than bitwise copy.

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

No branches or pull requests

2 participants