Skip to content

Instantly share code, notes, and snippets.

@kwilczynski
Created October 24, 2021 14:25
Show Gist options
  • Save kwilczynski/8b3d03ec5d685043c23d6ea29b404756 to your computer and use it in GitHub Desktop.
Save kwilczynski/8b3d03ec5d685043c23d6ea29b404756 to your computer and use it in GitHub Desktop.
>>> a = 975205316
>>> b = 4096
>>> (a + b) - (a % b)
975208448
>>> ((a + b) - (a % b)) + 64
975208512
>>> 975208448 % 4096
0
>>> a + (b - 1) & ~(b - 1)
975208448
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment