mirror of
https://github.com/mfontanini/libtins
synced 2026-01-23 02:35:57 +01:00
Fix alignment padding calculation.
This commit is contained in:
@@ -41,7 +41,8 @@ namespace Tins {
|
|||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
uint32_t calculate_padding(uint32_t alignment, uint32_t offset) {
|
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) {
|
uint32_t get_bit(uint32_t value) {
|
||||||
|
|||||||
Reference in New Issue
Block a user