[erlang-questions] Erlang VM in Rust

Richard A. O'Keefe ok@REDACTED
Thu Sep 14 00:01:48 CEST 2017



On 14/09/17 7:46 AM, Daniel Goertzen wrote:
> - Rust does not have bitfields but it does have the same bit mashing
> operators as C (& | ^ !  << >>).   C bitfields have different memory
> layouts on different platforms which limits their usefulness.  All the
> microcontroller C code I've ever seen has opted for explicit bit mashing
> instead of bitfields.

Back in the 1980s, I learned very quickly that bitfield manipulation in
C was (a) more portable and (b) faster if I used masking and shifting
than if I used bitfield syntax.  Compilers have got a lot better since
then, but (a) is still an issue.  However, when you want bitfields in C,
it's usually to interface with something that is platform-specific
anyway.  For example, code to get at the fields of an IEEE floating-
point number.



More information about the erlang-questions mailing list