mozilla/rust — pull request #13209 by lucab (2014-03-30 15:45:41+00:00)
Title: [RFC] num: bitwise reflection methods

A bit-manipulation PR, however I still have some doubts:
* Library. I believe this is a pretty core operation for several algorithms (eg. many checksums), is the "battery-included" philosophy ok for libstd?
* Naming. Is `reflect()` too generic? That's how the operation is usually called, but may be too broad as API and conflict with reflection/introspection.
* Lot's of redundancy here: 8, 16, 32 and 64 variants. I tried implementing it more generically, however:
* The `Bitwise` trait lacks `One`, `Zero` and `NumCast` for this implementation to work. Maybe they should be added anyway?
* Is it possible to split `impl Bitwise for i8..i64` in multiple files? Most of it is through instrinsics in each module, but ideally `reflect()` could be directly implemented in uint/int_macros abusing `$T`.

----

Let Bitwise provide a reflect() method for reversed binary
representation. This is a binary primitive used in several algorithms,
eg. CRC checksums.