1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

Fix for wrong address alignment rounding

The original V39/V40 amiga.lib puddle creation code did not round up, it rounded off.
This commit is contained in:
Olaf Barthel
2023-10-11 09:15:28 +02:00
parent d37909e409
commit f9d1222bd7

View File

@ -291,7 +291,7 @@ static union PuddleUnion * create_new_puddle(struct MemoryPool * mp)
* cleared and then the individual puddle allocations made * cleared and then the individual puddle allocations made
* through LibAllocPooled() will be cleared, too. * through LibAllocPooled() will be cleared, too.
*/ */
pu = alloc_vec(sizeof(pu->pu_MemHeader) + puddle_size + sizeof(APTR), memory_flags); pu = alloc_vec(sizeof(pu->pu_MemHeader) + sizeof(LONG) + puddle_size, memory_flags);
if (pu == NULL) if (pu == NULL)
goto out; goto out;
@ -301,7 +301,7 @@ static union PuddleUnion * create_new_puddle(struct MemoryPool * mp)
* and must be aligned to a 64 bit address. This happens to be * and must be aligned to a 64 bit address. This happens to be
* the smallest allocatable memory unit (MEM_BLOCKSIZE == 8). * the smallest allocatable memory unit (MEM_BLOCKSIZE == 8).
*/ */
mc = (struct MemChunk *)(((ULONG)&mh[1] + MEM_BLOCKMASK) & ~MEM_BLOCKMASK); mc = (struct MemChunk *)(((ULONG)&mh[1] + sizeof(LONG)) & ~MEM_BLOCKMASK);
mc->mc_Next = NULL; mc->mc_Next = NULL;
mc->mc_Bytes = puddle_size; mc->mc_Bytes = puddle_size;