You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I originally wrote/copied the RNG implementation, I used a bunch of bit operations because I thought they were more efficient than multiplication, division, and modulo. They would be more efficient, however, I recently learned a little more about the compiler and discovered that when constants are involved in multiplication, division, and modulo operations, the compiler optimizes the operation with bit operations. Therefore, all bit operations do is make it slightly easier to compile rather than resulting in a small performance boost at runtime, at least when constants are involved like they originally were.
There are some instances where bit operations make some sense, such as when calculating the word position of the RNG, but using them everywhere only makes the code base a little harder to maintain. I am willing to remove all of the unnecessary bit operations to make the code a little more readable, using constants. I reckon this could be done with a single commit.
The text was updated successfully, but these errors were encountered:
When I originally wrote/copied the RNG implementation, I used a bunch of bit operations because I thought they were more efficient than multiplication, division, and modulo. They would be more efficient, however, I recently learned a little more about the compiler and discovered that when constants are involved in multiplication, division, and modulo operations, the compiler optimizes the operation with bit operations. Therefore, all bit operations do is make it slightly easier to compile rather than resulting in a small performance boost at runtime, at least when constants are involved like they originally were.
There are some instances where bit operations make some sense, such as when calculating the word position of the RNG, but using them everywhere only makes the code base a little harder to maintain. I am willing to remove all of the unnecessary bit operations to make the code a little more readable, using constants. I reckon this could be done with a single commit.
The text was updated successfully, but these errors were encountered: