Usage of Bit fields
I was wondering why there is an extensive use of bit fields in the core code of the engine and also in the examples that Epic made. Is it because of memory optimization reasons or is there some compiler optimization in the way they're handled for example? I understand that they're useful for flags and the such but sometimes i don't get why a uint_32 is being used for example instead of a uint_8 for setting 3 bits. Portability? :D excuse me if this is a naive question but it has been troubling me for some time
asked Jan 24 '15 at 10:47 AM in C++ Programming
Only 3 bits of the uint_32 are used. The next variable will use the next bits
Uses only 9 bits of the 32. I still have 23 bits to spare for other variables. Yes it's an optimization thing. This way many variables are stored tightly, while maintaining pretty names and easy to use. Modern computer's bottleneck is data transfer.
answered Aug 25 '16 at 12:05 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here