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

Move static functions to header file #3757

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions faiss/impl/index_read.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

#include <faiss/impl/index_read_utils.h>
#include <faiss/index_io.h>

#include <faiss/impl/io_macros.h>
Expand Down Expand Up @@ -61,7 +62,7 @@ namespace faiss {
* Read
**************************************************************/

static void read_index_header(Index* idx, IOReader* f) {
void read_index_header(Index* idx, IOReader* f) {
READ1(idx->d);
READ1(idx->ntotal);
idx_t dummy;
Expand Down Expand Up @@ -230,7 +231,7 @@ InvertedLists* read_InvertedLists(IOReader* f, int io_flags) {
}
}

static void read_InvertedLists(IndexIVF* ivf, IOReader* f, int io_flags) {
void read_InvertedLists(IndexIVF* ivf, IOReader* f, int io_flags) {
InvertedLists* ils = read_InvertedLists(f, io_flags);
if (ils) {
FAISS_THROW_IF_NOT(ils->nlist == ivf->nlist);
Expand Down Expand Up @@ -438,7 +439,7 @@ ProductQuantizer* read_ProductQuantizer(IOReader* reader) {
return pq;
}

static void read_direct_map(DirectMap* dm, IOReader* f) {
void read_direct_map(DirectMap* dm, IOReader* f) {
char maintain_direct_map;
READ1(maintain_direct_map);
dm->type = (DirectMap::Type)maintain_direct_map;
Expand All @@ -454,10 +455,10 @@ static void read_direct_map(DirectMap* dm, IOReader* f) {
}
}

static void read_ivf_header(
void read_ivf_header(
IndexIVF* ivf,
IOReader* f,
std::vector<std::vector<idx_t>>* ids = nullptr) {
std::vector<std::vector<idx_t>>* ids) {
read_index_header(ivf, f);
READ1(ivf->nlist);
READ1(ivf->nprobe);
Expand Down
30 changes: 30 additions & 0 deletions faiss/impl/index_read_utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

// Utils for index_read

#ifndef FAISS_INDEX_READ_UTILS_H
#define FAISS_INDEX_READ_UTILS_H

#include <faiss/IndexIVF.h>
#include <faiss/impl/io.h>

#pragma once

namespace faiss {

void read_index_header(Index* idx, IOReader* f);
void read_direct_map(DirectMap* dm, IOReader* f);
void read_ivf_header(
IndexIVF* ivf,
IOReader* f,
std::vector<std::vector<idx_t>>* ids = nullptr);
void read_InvertedLists(IndexIVF* ivf, IOReader* f, int io_flags);

} // namespace faiss

#endif
Loading