Skip to content

Instantly share code, notes, and snippets.

@ILightThings
Last active January 23, 2024 13:32
Show Gist options
  • Save ILightThings/c46a609a9957eccd35195d01f9fa267f to your computer and use it in GitHub Desktop.
Save ILightThings/c46a609a9957eccd35195d01f9fa267f to your computer and use it in GitHub Desktop.
Get the next biggest rounded number
# Useful for padding buffers
# Useful in C
Size_Of_Target = 189
Round_Number = 12
target = Size_Of_Target + Round_Number - (Size_Of_Target % Round_Number)
print(target)
#189 + 12 = 201
#189 % 12 = 9
#201 - 9 = 192
#Result: 192
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment