OpenCores
URL https://opencores.org/ocsvn/tinyvliw8/tinyvliw8/trunk

Subversion Repositories tinyvliw8

[/] [tinyvliw8/] [trunk/] [tools/] [asm/] [src/] [list.h] - Rev 6

Compare with Previous | Blame | View Log

/**
 * \file   list.h
 * \author Oliver Stecklina <stecklina@ihp-microelectronics.com>
 * \date   12.12.2015
 * 
 * \brief  Simple douple linked list implementation.
 *
 * <p>
 *    Copyright (C) 2015 IHP GmbH, Frankfurt (Oder), Germany
 *
 * This code is free software. It is licensed under the EUPL, Version 1.1
 * or - as soon they will be approved by the European Commission - subsequent
 * versions of the EUPL (the "License").
 * You may redistribute this code and/or modify it under the terms of this
 * License.
 * You may not use this work except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 * http://joinup.ec.europa.eu/software/page/eupl/licence-eupl
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * </p>
 */
 
#ifndef LIST_H
#define LIST_H
 
typedef struct _list_s {
	struct _list_s *next;
	struct _list_s *prev;
} list_t;
 
#define LIST_INIT(l) {(l)->prev = l; (l)->next = l;}
#define LIST_ENTRY(head, type, elem) (type *) (((unsigned long) (head)) - ((unsigned long) &(((type *) 0)->elem)))
 
static inline void list_add(list_t *list, list_t *elem)
{
	elem->prev = list;
	elem->next = list->next;
	list->next->prev = elem;
	list->next = elem;
}
 
static inline void list_add_last(list_t *list, list_t *elem)
{
	elem->next = list;
	elem->prev = list->prev;
	list->prev->next = elem;
	list->prev = elem;
}
 
#endif
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.