File tree Expand file tree Collapse file tree 4 files changed +21
-7
lines changed Expand file tree Collapse file tree 4 files changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -209,6 +209,13 @@ cargo bench
209
209
open target/criterion/report/index.html
210
210
` ` `
211
211
212
+ To automatically detect the Minimum Supported Rust Version (MSRV):
213
+
214
+ ` ` ` sh
215
+ cargo +stable install cargo-msrv
216
+ cargo msrv find --ignore-lockfile
217
+ ` ` `
218
+
212
219
# # JavaScript
213
220
214
221
# ## NodeJS
Original file line number Diff line number Diff line change @@ -16,15 +16,16 @@ categories = [
16
16
" wasm" ,
17
17
" external-ffi-bindings" ,
18
18
]
19
- include = [" /rust/**" , " /c/**" , " /include/**" , " /build.rs" ]
19
+ rust-version = " 1.64" # Introduced Core C FFI in stable Rust
20
+ include = [" rust/**" , " c/**" , " include/**" , " build.rs" ]
20
21
21
22
22
23
[lib ]
23
24
name = " simsimd"
24
25
path = " rust/lib.rs"
25
26
26
27
[build-dependencies ]
27
- cc = " 1.0.83 "
28
+ cc = " 1.2.36 "
28
29
29
30
30
31
[[bench ]]
@@ -48,6 +49,6 @@ default = []
48
49
std = []
49
50
50
51
[dev-dependencies ]
51
- criterion = { version = " 0.6 .0" }
52
+ criterion = { version = " 0.7 .0" }
52
53
rand = { version = " 0.9.1" }
53
54
half = { version = " 2.6.0" }
Original file line number Diff line number Diff line change @@ -2,14 +2,14 @@ fn main() -> Result<(), cc::Error> {
2
2
let mut build = cc:: Build :: new ( ) ;
3
3
4
4
build
5
+ // Prefer portable flags to support MSVC and older toolchains
6
+ . std ( "c99" ) // Enforce C99 standard when supported
5
7
. file ( "c/lib.c" )
6
8
. include ( "include" )
7
9
. define ( "SIMSIMD_NATIVE_F16" , "0" )
8
10
. define ( "SIMSIMD_NATIVE_BF16" , "0" )
9
11
. define ( "SIMSIMD_DYNAMIC_DISPATCH" , "1" )
10
12
. opt_level ( 3 )
11
- // Prefer portable flags to support MSVC and older toolchains
12
- . flag_if_supported ( "-std=c99" ) // Enforce C99 standard when supported
13
13
. flag_if_supported ( "-pedantic" ) // Strict compliance when supported
14
14
. warnings ( false ) ;
15
15
Original file line number Diff line number Diff line change 77
77
pub type Distance = f64 ;
78
78
pub type ComplexProduct = ( f64 , f64 ) ;
79
79
80
+ /// Compatibility function for pre 1.85 Rust versions lacking `f32::abs`.
81
+ #[ inline( always) ]
82
+ fn f32_abs_compat ( x : f32 ) -> f32 {
83
+ f32:: from_bits ( x. to_bits ( ) & 0x7FFF_FFFF )
84
+ }
85
+
80
86
#[ link( name = "simsimd" ) ]
81
87
extern "C" {
82
88
@@ -251,7 +257,7 @@ impl f16 {
251
257
/// Returns the absolute value of self.
252
258
#[ inline( always) ]
253
259
pub fn abs ( self ) -> Self {
254
- Self :: from_f32 ( self . to_f32 ( ) . abs ( ) )
260
+ Self :: from_f32 ( f32_abs_compat ( self . to_f32 ( ) ) )
255
261
}
256
262
257
263
/// Returns the largest integer less than or equal to a number.
@@ -425,7 +431,7 @@ impl bf16 {
425
431
/// Returns the absolute value of self.
426
432
#[ inline( always) ]
427
433
pub fn abs ( self ) -> Self {
428
- Self :: from_f32 ( self . to_f32 ( ) . abs ( ) )
434
+ Self :: from_f32 ( f32_abs_compat ( self . to_f32 ( ) ) )
429
435
}
430
436
431
437
/// Returns the largest integer less than or equal to a number.
You can’t perform that action at this time.
0 commit comments