Changeset View
Changeset View
Standalone View
Standalone View
src/secp256k1/src/util.h
Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | |||||
#define ALIGNMENT __BIGGEST_ALIGNMENT__ | #define ALIGNMENT __BIGGEST_ALIGNMENT__ | ||||
#else | #else | ||||
/* Using 16 bytes alignment because common architectures never have alignment | /* Using 16 bytes alignment because common architectures never have alignment | ||||
* requirements above 8 for any of the types we care about. In addition we | * requirements above 8 for any of the types we care about. In addition we | ||||
* leave some room because currently we don't care about a few bytes. */ | * leave some room because currently we don't care about a few bytes. */ | ||||
#define ALIGNMENT 16 | #define ALIGNMENT 16 | ||||
#endif | #endif | ||||
#define ROUND_TO_ALIGN(size) (((size + ALIGNMENT - 1) / ALIGNMENT) * ALIGNMENT) | #define ROUND_TO_ALIGN(size) ((((size) + ALIGNMENT - 1) / ALIGNMENT) * ALIGNMENT) | ||||
/* Assume there is a contiguous memory object with bounds [base, base + max_size) | /* Assume there is a contiguous memory object with bounds [base, base + max_size) | ||||
* of which the memory range [base, *prealloc_ptr) is already allocated for usage, | * of which the memory range [base, *prealloc_ptr) is already allocated for usage, | ||||
* where *prealloc_ptr is an aligned pointer. In that setting, this functions | * where *prealloc_ptr is an aligned pointer. In that setting, this functions | ||||
* reserves the subobject [*prealloc_ptr, *prealloc_ptr + alloc_size) of | * reserves the subobject [*prealloc_ptr, *prealloc_ptr + alloc_size) of | ||||
* alloc_size bytes by increasing *prealloc_ptr accordingly, taking into account | * alloc_size bytes by increasing *prealloc_ptr accordingly, taking into account | ||||
* alignment requirements. | * alignment requirements. | ||||
* | * | ||||
▲ Show 20 Lines • Show All 155 Lines • Show Last 20 Lines |