library/src/utility/BP-NumberUtilities.cc
// Pushes an array onto a heap allocated array of uint16_t. Automatically
// allocates memory via realloc.  Final allocated array must be freed.
Pushes an array onto a heap allocated array of uint16_t. Automatically
allocates memory via realloc.  Final allocated array must be freed.
Pushes an array onto a heap allocated array of uint16_t . Automatically allocates memory via realloc . Final allocated array must be freed .
BP_ERROR_T BP_ArrayPushUInt16(uint16_t value, uint16_t ** stack, uint16_t *stack_n, P_BP_LINKL tq)
{
	if(!stack_n)
		return ERR_FAILURE;
	uint16_t new_stack_size = (*stack_n+1) * sizeof(uint16_t);
	if(!tq)
		stack[0] = (uint16_t *) bprealloc(*stack, new_stack_size);
	else
		stack[0] = (uint16_t *) tq_realloc(tq, *stack, new_stack_size, BPLN);
	stack[0][*stack_n] = value;
	*stack_n = *stack_n + 1;
	return ERR_SUCCESS;
}
BP_ERROR_T BP_ArrayPushUInt16 ( uint16_t value , uint16_t * * stack , uint16_t * stack_n , P_BP_LINKL tq ) { if ( ! stack_n ) return ERR_FAILURE ; uint16_t new_stack_size = ( * stack_n + 1 ) * sizeof ( uint16_t ) ; if ( ! tq ) stack [ 0 ] = ( uint16_t * ) bprealloc ( * stack , new_stack_size ) ; else stack [ 0 ] = ( uint16_t * ) tq_realloc ( tq , * stack , new_stack_size , BPLN ) ; stack [ 0 ] [ * stack_n ] = value ; * stack_n = * stack_n + 1 ; return ERR_SUCCESS ; }
Pushes an array onto a heap allocated array of uint16_t.
Pushes an array onto a heap allocated array of uint16_t .
// ensure we have a pointer to the stack // calculate the new stack size based on provided inputs // create new stack // set the value in the gadget stack // increment the stack counter // return indicating success