Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/src/cmd/dsslib/ip_t/ptlib.h
1810 views
1
/***********************************************************************
2
* *
3
* This software is part of the ast package *
4
* Copyright (c) 2000-2011 AT&T Intellectual Property *
5
* and is licensed under the *
6
* Eclipse Public License, Version 1.0 *
7
* by AT&T Intellectual Property *
8
* *
9
* A copy of the License is available at *
10
* http://www.eclipse.org/org/documents/epl-v10.html *
11
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
12
* *
13
* Information and Software Systems Research *
14
* AT&T Research *
15
* Florham Park NJ *
16
* *
17
* Glenn Fowler <[email protected]> *
18
* Phong Vo <[email protected]> *
19
* *
20
***********************************************************************/
21
#pragma prototyped
22
/*
23
* prefix table private interface
24
*
25
* Glenn Fowler
26
* AT&T Research
27
*/
28
29
#ifndef _PTPREFIX_PRIVATE_
30
31
#define _PTPREFIX_PRIVATE_ \
32
Dtlink_t link;
33
34
#include <cdt.h>
35
#include <error.h>
36
37
#include "pt.h"
38
39
#define PTSCAN(t,x,b,m,s) \
40
do \
41
{ \
42
Ptprefix_t* _pt_p; \
43
Ptaddr_t _pt_min; \
44
Ptaddr_t _pt_max; \
45
Ptaddr_t m; \
46
Ptaddr_t x; \
47
unsigned int b; \
48
for (_pt_p = (Ptprefix_t*)dtfirst((t)->dict); _pt_p; _pt_p = (Ptprefix_t*)dtnext((t)->dict, _pt_p)) \
49
{ \
50
_pt_min = _pt_p->min; \
51
_pt_max = _pt_p->max; \
52
do \
53
{ \
54
x = _pt_min; \
55
m = 1; \
56
b = PTBITS; \
57
while (m && \
58
!(x & ((1<<PTSHIFT)-1)) && \
59
(_pt_min|((m<<PTSHIFT)-1)) <= _pt_max) \
60
{ \
61
x >>= PTSHIFT; \
62
m <<= PTSHIFT; \
63
b -= PTSHIFT; \
64
} \
65
x = _pt_min; \
66
s; \
67
if (!b || (_pt_min += m) < x) \
68
break; \
69
} while (_pt_min <= _pt_max); \
70
} \
71
} while (0)
72
73
#endif
74
75