Created
November 16, 2013 04:12
-
-
Save StefanoFiumara/7495847 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int VirtualMemoryManager::get_mask(int last_x_bits) { | |
int mask = 0; | |
for(int i = 0; i < last_x_bits; i++) { | |
mask += pow(2, i); | |
} | |
return mask; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just do
mask = (1 << last_x_bits) - 1