From 20fe3e13181ea8a16bd657c2fe7637bac2f25313 Mon Sep 17 00:00:00 2001 From: little_huang <53588889+little-huang@users.noreply.github.com> Date: Thu, 8 Aug 2024 08:10:31 +0800 Subject: [PATCH 1/4] Update README.md Node.js Link (#67) This link is 404: https://alexgarcia.xyz/sqlite-vec/nodejs.html updated to: https://alexgarcia.xyz/sqlite-vec/js.html --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 38a0fda..f6994ef 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ for more details. | Language | Install | More Info | | | -------------- | ---------------------------------------------------- | ------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Python | `pip install sqlite-vec` | [`sqlite-vec` with Python](https://alexgarcia.xyz/sqlite-vec/python.html) | [![PyPI](https://img.shields.io/pypi/v/sqlite-vec.svg?color=blue&logo=python&logoColor=white)](https://pypi.org/project/sqlite-vec/) | -| Node.js | `npm install sqlite-vec` | [`sqlite-vec` with Node.js](https://alexgarcia.xyz/sqlite-vec/nodejs.html) | [![npm](https://img.shields.io/npm/v/sqlite-vec.svg?color=green&logo=nodedotjs&logoColor=white)](https://www.npmjs.com/package/sqlite-vec) | +| Node.js | `npm install sqlite-vec` | [`sqlite-vec` with Node.js](https://alexgarcia.xyz/sqlite-vec/js.html) | [![npm](https://img.shields.io/npm/v/sqlite-vec.svg?color=green&logo=nodedotjs&logoColor=white)](https://www.npmjs.com/package/sqlite-vec) | | Ruby | `gem install sqlite-vec` | [`sqlite-vec` with Ruby](https://alexgarcia.xyz/sqlite-vec/ruby.html) | ![Gem](https://img.shields.io/gem/v/sqlite-vec?color=red&logo=rubygems&logoColor=white) | | Go | `go get -u github.com/asg017/sqlite-vec/bindings/go` | [`sqlite-vec` with Go](https://alexgarcia.xyz/sqlite-vec/go.html) | [![Go Reference](https://pkg.go.dev/badge/github.com/asg017/sqlite-vec-go-bindings/cgo.svg)](https://pkg.go.dev/github.com/asg017/asg017/sqlite-vec-go-bindings/cgo) | | Rust | `cargo add sqlite-vec` | [`sqlite-vec` with Rust](https://alexgarcia.xyz/sqlite-vec/rust.html) | [![Crates.io](https://img.shields.io/crates/v/sqlite-vec?logo=rust)](https://crates.io/crates/sqlite-vec) | From 458cf0ba615d8aef7da756bf8c9ceb1388e69b89 Mon Sep 17 00:00:00 2001 From: Jimmy Stridh <61634+jimmystridh@users.noreply.github.com> Date: Thu, 8 Aug 2024 02:10:56 +0200 Subject: [PATCH 2/4] fix "Installing" link in README (#65) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f6994ef..a0ca1df 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ See the Sponsors section for more details. ## Installing -See [Installing `sqlite-vec`](https://alexgarcia.xyz/sqlite-vec/installing.html) +See [Installing `sqlite-vec`](https://alexgarcia.xyz/sqlite-vec/installation.html) for more details. | Language | Install | More Info | | From 6cccfae273235ccc95e55da240b19ec4c416cc5e Mon Sep 17 00:00:00 2001 From: Sheldon Robinson Date: Fri, 9 Aug 2024 13:07:15 -0400 Subject: [PATCH 3/4] Add implementation for __builtin_popcountl for Windows on ARM (#72) Window on Arm missing the __popcnt64 function. Adding static implementation based on https://github.com/ngtcp2/ngtcp2/blob/b64f1e77b5e0d880b93d31f474147fae4a1d17cc/lib/ngtcp2_ringbuf.c, line 34-43 --- sqlite-vec.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sqlite-vec.c b/sqlite-vec.c index 6ba2a23..5355845 100644 --- a/sqlite-vec.c +++ b/sqlite-vec.c @@ -505,9 +505,21 @@ static f32 distance_hamming_u8(u8 *a, u8 *b, size_t n) { } #ifdef _MSC_VER +#if !defined(__clang__) && \ + (defined(_M_ARM) || defined(_M_ARM64)) +// From https://github.com/ngtcp2/ngtcp2/blob/b64f1e77b5e0d880b93d31f474147fae4a1d17cc/lib/ngtcp2_ringbuf.c, line 34-43 +static unsigned int __builtin_popcountl(unsigned int x) { + unsigned int c = 0; + for (; x; ++c) { + x &= x - 1; + } + return c; +} +#else #include #define __builtin_popcountl __popcnt64 #endif +#endif static f32 distance_hamming_u64(u64 *a, u64 *b, size_t n) { int same = 0; From 6c26399269888382805e27f8cfbe56a619e39434 Mon Sep 17 00:00:00 2001 From: Sheldon Robinson Date: Fri, 9 Aug 2024 13:26:45 -0400 Subject: [PATCH 4/4] Fix compilation error for redefinition of jsonIsspace (#75) * Fix compilation error for redefinition of jsonIsspace when including in amalgamation build of sqlite3.c * Fix redefinition variable jsonIsSpaceX[] * Add check for SQLITE_AMALGMATION * Add check for SQLITE_CORE --- sqlite-vec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sqlite-vec.c b/sqlite-vec.c index 5355845..7ab7e9e 100644 --- a/sqlite-vec.c +++ b/sqlite-vec.c @@ -546,6 +546,7 @@ static f32 distance_hamming(const void *a, const void *b, const void *d) { return distance_hamming_u8((u8 *)a, (u8 *)b, dimensions / CHAR_BIT); } +#if !defined(SQLITE_CORE) || (defined(SQLITE_AMALGAMATION) && defined(SQLITE_OMIT_JSON)) // from SQLite source: // https://github.com/sqlite/sqlite/blob/a509a90958ddb234d1785ed7801880ccb18b497e/src/json.c#L153 static const char jsonIsSpaceX[] = { @@ -563,7 +564,9 @@ static const char jsonIsSpaceX[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; + #define jsonIsspace(x) (jsonIsSpaceX[(unsigned char)x]) +#endif typedef void (*vector_cleanup)(void *p);