'
This commit is contained in:
parent
18540d32e4
commit
fd1c0872a4
2 changed files with 20 additions and 0 deletions
10
alignment/alignment.c
Normal file
10
alignment/alignment.c
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#include "alignment.h"
|
||||
|
||||
size_t align(size_t size)
|
||||
{
|
||||
size_t res;
|
||||
if (__builtin_add_overflow(size, 8 - (size % 8), &res))
|
||||
return 0;
|
||||
|
||||
return res;
|
||||
}
|
||||
10
alignment/alignment.h
Normal file
10
alignment/alignment.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef ALIGNMENT_H
|
||||
#define ALIGNMENT_H
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
size_t align(size_t size);
|
||||
|
||||
#endif /* !ALIGNMENT_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue