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

Subversion Repositories tinyvliw8

[/] [tinyvliw8/] [trunk/] [tools/] [asm/] [src/] [list.h] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 steckol
/**
2
 * \file   list.h
3
 * \author Oliver Stecklina <stecklina@ihp-microelectronics.com>
4
 * \date   12.12.2015
5
 *
6
 * \brief  Simple douple linked list implementation.
7
 *
8
 * <p>
9
 *    Copyright (C) 2015 IHP GmbH, Frankfurt (Oder), Germany
10
 *
11
 * This code is free software. It is licensed under the EUPL, Version 1.1
12
 * or - as soon they will be approved by the European Commission - subsequent
13
 * versions of the EUPL (the "License").
14
 * You may redistribute this code and/or modify it under the terms of this
15
 * License.
16
 * You may not use this work except in compliance with the License.
17
 * You may obtain a copy of the License at:
18
 *
19
 * http://joinup.ec.europa.eu/software/page/eupl/licence-eupl
20
 *
21
 * Unless required by applicable law or agreed to in writing, software
22
 * distributed under the License is distributed on an "AS IS" basis,
23
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
 * See the License for the specific language governing permissions and
25
 * limitations under the License.
26
 * </p>
27
 */
28
 
29 5 steckol
#ifndef LIST_H
30
#define LIST_H
31
 
32
typedef struct _list_s {
33
        struct _list_s *next;
34
        struct _list_s *prev;
35
} list_t;
36
 
37
#define LIST_INIT(l) {(l)->prev = l; (l)->next = l;}
38
#define LIST_ENTRY(head, type, elem) (type *) (((unsigned long) (head)) - ((unsigned long) &(((type *) 0)->elem)))
39
 
40
static inline void list_add(list_t *list, list_t *elem)
41
{
42
        elem->prev = list;
43
        elem->next = list->next;
44
        list->next->prev = elem;
45
        list->next = elem;
46
}
47
 
48
static inline void list_add_last(list_t *list, list_t *elem)
49
{
50
        elem->next = list;
51
        elem->prev = list->prev;
52
        list->prev->next = elem;
53
        list->prev = elem;
54
}
55
 
56
#endif

powered by: WebSVN 2.1.0

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