DoumanAsh / xxhash-rust

Rust implementation of xxhash
Boost Software License 1.0
205 stars 20 forks source link

merge const fn #39

Closed yyy33 closed 5 months ago

yyy33 commented 5 months ago

hi, I found a function called core::intrinsics::const_eval_select, can we use him to merge the const and runtime functions to provide only one const version

DoumanAsh commented 5 months ago

You generally should not use const fn outside of const/static contextes so I do not believe it is worth to consider

Eventually compiler will reach state when non const version can be the same as const version, but until then it is safer to have separate const fn version

But even if intrinsics were to be stable (they are not) it will not change much for this library It is better to delegate const/non-const selection to user