1/* 2 * definitions for dc's "register" declarations 3 * 4 * Copyright (C) 1994 Free Software Foundation, Inc. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2, or (at your option) 9 * any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, you can either send email to this 18 * program's author (see below) or write to: 19 * 20 * The Free Software Foundation, Inc. 21 * 59 Temple Place, Suite 330 22 * Boston, MA 02111 USA 23 */ 24 25#ifdef HAVE_LIMITS_H 26# include <limits.h> /* UCHAR_MAX */ 27#endif 28 29/* determine how many register stacks there are */ 30#ifndef DC_REGCOUNT 31# ifndef UCHAR_MAX 32# define DC_REGCOUNT 256 33# else 34# define DC_REGCOUNT (UCHAR_MAX+1) 35# endif 36#endif /* not DC_REGCOUNT */ 37 38/* efficiency hack for masking arbritrary integers to 0..(DC_REGCOUNT-1) */ 39#if (DC_REGCOUNT & (DC_REGCOUNT-1)) == 0 /* DC_REGCOUNT is power of 2 */ 40# define regmap(r) ((r) & (DC_REGCOUNT-1)) 41#else 42# define regmap(r) ((r) % DC_REGCOUNT) 43#endif 44