Skip to content
Merged
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
8 changes: 7 additions & 1 deletion c_api/Index_c_ex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Copyright 2023-present Facebook. All Rights Reserved.
// -*- c++ -*-

#include "Index_c.h"
#include "Index_c_ex.h"
#include <faiss/Index.h>
#include "macros_impl.h"

Expand All @@ -30,4 +30,10 @@ int faiss_Index_merge_from(FaissIndex* index, FaissIndex* other, const idx_t add
CATCH_AND_HANDLE
}

size_t faiss_Index_size(FaissIndex* index) {
auto xIndex = reinterpret_cast<faiss::Index*>(index);
size_t rv = sizeof(xIndex);
return rv;
}

}
4 changes: 4 additions & 0 deletions c_api/Index_c_ex.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
#define FAISS_INDEX_EX_C_H

#include <stddef.h>
#include <stdio.h>
#include "faiss_c.h"
#include "Index_c.h"


#ifdef __cplusplus
extern "C" {
#endif
Expand All @@ -25,6 +27,8 @@ int faiss_Index_reconstruct_batch(const FaissIndex* index, idx_t n,

int faiss_Index_merge_from(FaissIndex* index, FaissIndex* other, idx_t add_id);

size_t faiss_Index_size(FaissIndex* index);

#ifdef __cplusplus
}
#endif
Expand Down