/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 2000-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Glenn Fowler <[email protected]> *17* Phong Vo <[email protected]> *18* *19***********************************************************************/20#pragma prototyped21/*22* prefix table private interface23*24* Glenn Fowler25* AT&T Research26*/2728#ifndef _PTPREFIX_PRIVATE_2930#define _PTPREFIX_PRIVATE_ \31Dtlink_t link;3233#include <cdt.h>34#include <error.h>3536#include "pt.h"3738#define PTSCAN(t,x,b,m,s) \39do \40{ \41Ptprefix_t* _pt_p; \42Ptaddr_t _pt_min; \43Ptaddr_t _pt_max; \44Ptaddr_t m; \45Ptaddr_t x; \46unsigned int b; \47for (_pt_p = (Ptprefix_t*)dtfirst((t)->dict); _pt_p; _pt_p = (Ptprefix_t*)dtnext((t)->dict, _pt_p)) \48{ \49_pt_min = _pt_p->min; \50_pt_max = _pt_p->max; \51do \52{ \53x = _pt_min; \54m = 1; \55b = PTBITS; \56while (m && \57!(x & ((1<<PTSHIFT)-1)) && \58(_pt_min|((m<<PTSHIFT)-1)) <= _pt_max) \59{ \60x >>= PTSHIFT; \61m <<= PTSHIFT; \62b -= PTSHIFT; \63} \64x = _pt_min; \65s; \66if (!b || (_pt_min += m) < x) \67break; \68} while (_pt_min <= _pt_max); \69} \70} while (0)7172#endif737475