/* Function for evaluating if the page erase operation is required for the current page.  */
static bool is_page_erase_required(void)
/* Function for evaluating if the page erase operation is required for the current page.  */
static bool is_page_erase_required(void)
{
    bool ret;
    const cmd_queue_element_t * p_cmd                      = &m_cmd_queue.cmd[m_cmd_queue.rp];
    const pstorage_block_t      cmd_block_id               = p_cmd->storage_addr.block_id;        
    const uint32_t              id_last_page_to_be_cleared = (cmd_block_id + p_cmd->size + 
                                                             p_cmd->offset - 1u) / 
                                                             PSTORAGE_FLASH_PAGE_SIZE;
    if ((m_current_page_id < id_last_page_to_be_cleared) ||
        ((m_current_page_id == id_last_page_to_be_cleared) && (m_tail_word_size == 0)))         
    {
        ret = true;
    }
    else
    {
        ret = false;
    }
    return ret;
}