Last active
August 29, 2015 14:14
-
-
Save killwing/0b0fa26babc928f42c2a to your computer and use it in GitHub Desktop.
useful bit hacks
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
// round down to multiple of 1024 | |
size_t roundDown(size_t s) { | |
return s & ~1023; | |
} | |
// round up to multiple of 1024 | |
size_t roundUp(size_t s) { | |
return (s + 1023) & ~1023; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment