rust/library/core
Matthias Krüger 720c6f19b7
Rollup merge of #127252 - fitzgen:edge-cases-for-bitwise-operations, r=m-ou-se
Add edge-case examples to `{count,leading,trailing}_{ones,zeros}` methods

Some architectures (i386) do not define a "count leading zeros" instruction, they define a "find first set bit" instruction (`bsf`) whose result is undefined when given zero (ie none of the bits are set). Of this family of bitwise operations, I always forget which of these things is potentially undefined for zero, and I'm also not 100% sure that Rust provides a hard guarantee for the results of these methods when given zero. So I figured there are others who have these same uncertainties, and it would be good to resolve them and answer the question via extending these doc examples/tests.

See https://en.wikipedia.org/wiki/Find_first_set#Hardware_support for more info on i386 and `bsf` on zero.
2024-07-24 18:00:36 +02:00
..
benches Write char::DebugEscape sequences using write_str 2024-05-20 10:04:44 +02:00
src Rollup merge of #127252 - fitzgen:edge-cases-for-bitwise-operations, r=m-ou-se 2024-07-24 18:00:36 +02:00
tests Avoid ref when using format! for perf 2024-07-19 12:23:49 -04:00
Cargo.toml Cleanup bootstrap check-cfg 2024-06-27 11:30:03 +02:00