configTOTAL_HEAP_SIZE byte exactly with heap_1

I agree with you,I think it’s a bug. It should be
if( ( ( xNextFreeByte + xWantedSize ) <= configADJUSTED_HEAP_SIZE ) && ( xWantedSize > 0 ) )
The code implementation wastes space, not very clear.
I ThinkThe best step is:
1.ucHeap Align to portBYTE_ALIGNMENT,head wasted. if ucHeap is already align to portBYTE_ALIGNMENT then head wasted=0.
2.Then (configTOTAL_HEAP_SIZE - head wasted) Align to portBYTE_ALIGNMENT.Tail wasted.
if (configTOTAL_HEAP_SIZE - head wasted) is already align to portBYTE_ALIGNMENT,then Tail wasted=0.
3.configADJUSTED_HEAP_SIZE = configTOTAL_HEAP_SIZE - head wasted - Tail wasted.
and pucAlignedHeap = ucHeap - head wasted.
configADJUSTED_HEAP_SIZE = ( configTOTAL_HEAP_SIZE - portBYTE_ALIGNMENT ) is not suitable. because portBYTE_ALIGNMENT is not always equal to head wasted plus Tail wasted.
pucAlignedHeap = ( uint8_t * ) ( ( ( portPOINTER_SIZE_TYPE ) &ucHeap[ portBYTE_ALIGNMENT ] ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) ); also is not suitable.
when ucHeap is already align to portBYTE_ALIGNMENT,This wastes space with a size of portBYTE_ALIGNMENT.