Add additional comments to Aligned Allocator (GH #779)
parent
3fba3b0a1c
commit
7969f7181f
3
misc.cpp
3
misc.cpp
|
|
@ -298,10 +298,13 @@ void * AlignedAllocate(size_t size)
|
||||||
|
|
||||||
#ifdef CRYPTOPP_NO_ALIGNED_ALLOC
|
#ifdef CRYPTOPP_NO_ALIGNED_ALLOC
|
||||||
size_t adjustment = 16-((size_t)p%16);
|
size_t adjustment = 16-((size_t)p%16);
|
||||||
|
CRYPTOPP_ASSERT(adjustment > 0);
|
||||||
p += adjustment;
|
p += adjustment;
|
||||||
p[-1] = (byte)adjustment;
|
p[-1] = (byte)adjustment;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// If this assert fires then there are problems that need
|
||||||
|
// to be fixed. Please open a bug report.
|
||||||
CRYPTOPP_ASSERT(IsAlignedOn(p, 16));
|
CRYPTOPP_ASSERT(IsAlignedOn(p, 16));
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue