Fix build errors and spacing

This commit is contained in:
Mahesh Madhav 2026-06-24 14:35:55 -04:00
parent cfd526afd0
commit 2eb8f38cd1
1 changed files with 11 additions and 10 deletions

View File

@ -88,31 +88,32 @@ void Hop_ManStopMemory( Hop_Man_t * p )
***********************************************************************/ ***********************************************************************/
void Hop_ManAddMemory( Hop_Man_t * p ) void Hop_ManAddMemory( Hop_Man_t * p )
{ {
Hop_Obj_t * pMemory; char * pMemory = 0;
char *PMemAlign = 0; Hop_Obj_t * pEntry, * pNext;
int i, nBytes; int i, nBytes;
assert( sizeof(Hop_Obj_t) <= 64 ); assert( sizeof(Hop_Obj_t) <= 64 );
assert( p->pListFree == NULL ); assert( p->pListFree == NULL );
// assert( (Hop_ManObjNum(p) & IVY_PAGE_MASK) == 0 ); // assert( (Hop_ManObjNum(p) & IVY_PAGE_MASK) == 0 );
// allocate new memory page // allocate new memory page
nBytes = sizeof(Hop_Obj_t) * (1<<IVY_PAGE_SIZE) + 64; nBytes = sizeof(Hop_Obj_t) * (1<<IVY_PAGE_SIZE) + 64;
PMemAlign = PMemAlign + 64 - (((int)(ABC_PTRUINT_T)PMemAlign) & 63); pMemory = pMemory + 64 - (((int)(ABC_PTRUINT_T)pMemory) & 63);
pMemory = (Hop_Obj_t *)PMemAlign; pMemory = ABC_ALLOC( char, nBytes );
Vec_PtrPush( p->vChunks, pMemory ); Vec_PtrPush( p->vChunks, pMemory );
// align memory at the 32-byte boundary // align memory at the 32-byte boundary
pMemory = pMemory + 64 - (((int)(ABC_PTRUINT_T)pMemory) & 63); pMemory = pMemory + 64 - (((int)(ABC_PTRUINT_T)pMemory) & 63);
// remember the manager in the first entry // remember the manager in the first entry
Vec_PtrPush( p->vPages, pMemory ); Vec_PtrPush( p->vPages, pMemory );
// break the memory down into nodes // break the memory down into nodes
p->pListFree = (Hop_Obj_t *)pMemory; pEntry = (Hop_Obj_t *)pMemory;
p->pListFree = pEntry;
for ( i = 1; i <= IVY_PAGE_MASK; i++ ) for ( i = 1; i <= IVY_PAGE_MASK; i++ )
{ {
Hop_Obj_t *NextPtr = pMemory + 1; pNext = pEntry + 1;
memcpy(pMemory, &NextPtr, sizeof(Hop_Obj_t *)); memcpy( pEntry, &pNext, sizeof(Hop_Obj_t *) );
pMemory += 1; pEntry++;
} }
Hop_Obj_t *NullPtr = NULL; pNext = NULL;
memcpy(pMemory, &NullPtr, sizeof(Hop_Obj_t *)); memcpy( pEntry, &pNext, sizeof(Hop_Obj_t *) );
} }
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////