mercredi 18 décembre 2019

Why does program size shrink significantly when binary variables were converted from bit-fields to characters? How?

Im reading The Programming Language C ++ 4th edition.

The text is written as follows:

Surprisingly, using fields to pack several variables into a single byte does not necessarily save space. It saves data space, but the size of the code needed to manipulate these variables increases on most machines. Programs have been known to shrink significantly when binary variables were converted from bit-fields to characters! Furthermore, it is typically much faster to access a char or an int than to access a field. Fields are simply a convenient shorthand for using bitwise logical operators (§11.1.1) to extract information from and insert information into part of a word.

Why does program size shrink significantly when binary variables were converted from bit-fields to characters?

How to write it?

I can't imagine the above explanation.

Aucun commentaire:

Enregistrer un commentaire