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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [insight/] [libiberty/] [insque.c] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/* insque(3C) routines
2
   This file is in the public domain.  */
3
 
4
/*
5
NAME
6
        insque, remque -- insert, remove an element from a queue
7
 
8
SYNOPSIS
9
        struct qelem {
10
          struct qelem *q_forw;
11
          struct qelem *q_back;
12
          char q_data[];
13
        };
14
 
15
        void insque (struct qelem *elem, struct qelem *pred)
16
 
17
        void remque (struct qelem *elem)
18
 
19
DESCRIPTION
20
        Routines to manipulate queues built from doubly linked lists.
21
        The insque routine inserts ELEM in the queue immediately after
22
        PRED.  The remque routine removes ELEM from its containing queue.
23
*/
24
 
25
 
26
struct qelem {
27
  struct qelem *q_forw;
28
  struct qelem *q_back;
29
};
30
 
31
 
32
void
33
insque (elem, pred)
34
  struct qelem *elem;
35
  struct qelem *pred;
36
{
37
  elem -> q_forw = pred -> q_forw;
38
  pred -> q_forw -> q_back = elem;
39
  elem -> q_back = pred;
40
  pred -> q_forw = elem;
41
}
42
 
43
 
44
void
45
remque (elem)
46
  struct qelem *elem;
47
{
48
  elem -> q_forw -> q_back = elem -> q_back;
49
  elem -> q_back -> q_forw = elem -> q_forw;
50
}

powered by: WebSVN 2.1.0

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