This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
#define IDR_BITS 5
#define IDR_FULL 0xfffffffful
+#if 0 /* unused */
#define TOP_LEVEL_FULL (IDR_FULL >> 30)
+#endif
#define IDR_SIZE (1 << IDR_BITS)
#define IDR_MASK ((1 << IDR_BITS)-1)
#define MAX_ID_SHIFT (sizeof(int)*8 - 1)
int l, id;
uint32_t bm;
+ memset(pa, 0, sizeof(pa));
+
id = *starting_id;
p = idp->top;
l = idp->layers;
/* Mask off upper bits we don't use for the search. */
id &= MAX_ID_MASK;
- while (n > 0 && p) {
+ while (n >= IDR_BITS && p) {
n -= IDR_BITS;
p = p->ary[(id >> n) & IDR_MASK];
}