diff --git a/include/usearch/index.hpp b/include/usearch/index.hpp index 4fe87109..15d56f9c 100644 --- a/include/usearch/index.hpp +++ b/include/usearch/index.hpp @@ -42,10 +42,13 @@ #endif // Inferring hardware bitness: 32 vs 64 -#if __WORDSIZE == 64 +// https://stackoverflow.com/a/5273354 +#if INTPTR_MAX == INT64_MAX #define USEARCH_64BIT_ENV -#else +#elif INTPTR_MAX == INT32_MAX #define USEARCH_32BIT_ENV +#else +#error Unknown pointer size or missing size macros! #endif #if !defined(USEARCH_USE_OPENMP) diff --git a/python/usearch/index.py b/python/usearch/index.py index 19cbc324..e9ecd923 100644 --- a/python/usearch/index.py +++ b/python/usearch/index.py @@ -417,14 +417,16 @@ def __init__( self._compiled.load(path) @staticmethod - def metadata(path: os.PathLike) -> dict: + def metadata(path: os.PathLike) -> Optional[dict]: + if not os.path.exists(path): + return None return index_metadata(path) @staticmethod - def restore(path: os.PathLike, view: bool = False) -> Index: - if not os.path.exists(path): - return None + def restore(path: os.PathLike, view: bool = False) -> Optional[Index]: meta = Index.metadata(path) + if not meta: + return None return Index( ndim=meta["dimensions"], dtype=meta["kind_scalar"],