Open SIFT demo data in binary mode#5213
Conversation
|
Hi @massy-o! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
|
||
| float* fvecs_read(const char* fname, size_t* d_out, size_t* n_out) { | ||
| FILE* f = fopen(fname, "r"); | ||
| FILE* f = fopen(fname, "rb"); |
There was a problem hiding this comment.
Self-review: The demo treats .fvecs/.ivecs files as fixed-width binary records, so rb avoids platform text-mode translation before the size and fread assertions run.
|
@alibeklfc has imported this pull request. If you are a Meta employee, you can view this in D106137008. |
|
@alibeklfc merged this pull request in ca87f41. |
Summary
Why
The SIFT demo reads .fvecs/.ivecs data as fixed-width binary records. Opening the file with rb avoids platform text-mode translation, especially on Windows, and keeps the byte-size checks aligned with the actual file contents.
Testing