1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-22 18:25:57 +01:00

Fix alignment padding calculation.

This commit is contained in:
DDoSolitary
2019-03-10 11:48:56 +08:00
parent 78aa7d1787
commit 2f16497bf8

View File

@@ -41,7 +41,8 @@ namespace Tins {
namespace Utils {
uint32_t calculate_padding(uint32_t alignment, uint32_t offset) {
return offset % alignment;
uint32_t extra = offset % alignment;
return extra == 0 ? 0 : alignment - extra;
}
uint32_t get_bit(uint32_t value) {