DO NOT MERGE - Merge January 2020 Security Release into master
Bug: 147314974 Change-Id: Ia77f51c0996b4840fcb49376f35ea17f0b1fdf48
This commit is contained in:
commit
ccf87b69d5
1 changed files with 6 additions and 1 deletions
|
|
@ -52,7 +52,12 @@ public:
|
|||
|
||||
template<size_t N>
|
||||
static size_t align(void*& buffer) {
|
||||
return align<N>( const_cast<void const*&>(buffer) );
|
||||
static_assert(!(N & (N - 1)), "Can only align to a power of 2.");
|
||||
void* b = buffer;
|
||||
buffer = reinterpret_cast<void*>((uintptr_t(buffer) + (N-1)) & ~(N-1));
|
||||
size_t delta = size_t(uintptr_t(buffer) - uintptr_t(b));
|
||||
memset(b, 0, delta);
|
||||
return delta;
|
||||
}
|
||||
|
||||
static void advance(void*& buffer, size_t& size, size_t offset) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue