Re: [rust-dev] Find first set
You can express ffs in terms of nlz, which is available as Int::leading_zeros and appears to be implemented with LLVM intrinsics for most types. On Mon, Jan 12, 2015 at 10:17 AM, Kevin McGuire kmcg3...@gmail.com wrote: On Mon, Jan 12, 2015 at 11:12 AM, Matthew Hammer ham...@cs.umd.edu wrote: Hi Rust Developers, I’m in need of this bit-level operation: http://en.wikipedia.org/wiki/Find_first_set I’m happy to implement it as a loop, but it seems like many architectures support it directly, as does libc. Does anyone know if this is implemented in the Rust standard library or among the current primitives? Searching for “ffs” in the source tree got me nowhere. Thanks, -Matt I know that there have been people who have brought this to attention. I know there is likely someone who has written a solution, but I can not remember where it was located. I do remember that it involved the usage of inline assembly and #[cfg()] directives. It essentially provided a general implementation that worked everywhere, then it provided implementations specific to a certain architecture. By using the config attribute one could toggle between the generic or architecture specific method being implemented and thus callable. I do not know for certain if it is or is not implemented in the standard library, but I have the feeling that it is not. I tried to look for it but failed. ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev -- Peter Marheine Don't Panic ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev
Re: [rust-dev] Find first set
On Mon, Jan 12, 2015 at 11:12 AM, Matthew Hammer ham...@cs.umd.edu wrote: Hi Rust Developers, I’m in need of this bit-level operation: http://en.wikipedia.org/wiki/Find_first_set I’m happy to implement it as a loop, but it seems like many architectures support it directly, as does libc. Does anyone know if this is implemented in the Rust standard library or among the current primitives? Searching for “ffs” in the source tree got me nowhere. Thanks, -Matt I know that there have been people who have brought this to attention. I know there is likely someone who has written a solution, but I can not remember where it was located. I do remember that it involved the usage of inline assembly and #[cfg()] directives. It essentially provided a general implementation that worked everywhere, then it provided implementations specific to a certain architecture. By using the config attribute one could toggle between the generic or architecture specific method being implemented and thus callable. I do not know for certain if it is or is not implemented in the standard library, but I have the feeling that it is not. I tried to look for it but failed. ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev
[rust-dev] Find first set
Hi Rust Developers, I’m in need of this bit-level operation: http://en.wikipedia.org/wiki/Find_first_set http://en.wikipedia.org/wiki/Find_first_set I’m happy to implement it as a loop, but it seems like many architectures support it directly, as does libc. Does anyone know if this is implemented in the Rust standard library or among the current primitives? Searching for “ffs” in the source tree got me nowhere. Thanks, -Matt___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev