First version of alignment functions (imported from suma* programs)
This commit is contained in:
21
src/utils.h
21
src/utils.h
@ -53,4 +53,25 @@ int count_dir(char* dir_path);
|
||||
char* obi_format_date(time_t date);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Allocates a chunk of memory aligned on 16 bytes boundary.
|
||||
*
|
||||
* @warning The pointer returned must be freed by the caller.
|
||||
* @warning The memory chunk pointed at by the returned pointer can be
|
||||
* smaller than the size asked for, since the address is shifted
|
||||
* to be aligned.
|
||||
*
|
||||
* @param size The size in bytes of the memory chunk to be allocated.
|
||||
* Ideally the closest multiple of 16 greater than the wanted size.
|
||||
* @param shift A pointer on an integer corresponding to the shift made to align
|
||||
* the address. Used to free the memory chunk.
|
||||
*
|
||||
* @returns The pointer on the aligned memory.
|
||||
*
|
||||
* @since May 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
void* obi_get_memory_aligned_on_16(int size, int* shift);
|
||||
|
||||
|
||||
#endif /* UTILS_H_ */
|
||||
|
Reference in New Issue
Block a user