x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Usage of Bit fields

Hey guys,

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

Product Version: Not Selected
Tags:
more ▼

asked Jan 24 '15 at 10:47 AM in C++ Programming

avatar image

RoboticHuman
66 2 6 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Only 3 bits of the uint_32 are used. The next variable will use the next bits

For example:

 uint_32  var1 : 3;
 uint_32  var2 : 6;

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.

more ▼

answered Aug 25 '16 at 12:05 PM

avatar image

Plosnita
277 5 8 22

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question