Blame dc/dc-regdef.h

Packit 70b277
/*
Packit 70b277
 * definitions for dc's "register" declarations
Packit 70b277
 *
Packit 70b277
 * Copyright (C) 1994, 2000, 2008
Packit 70b277
 * Free Software Foundation, Inc.
Packit 70b277
 *
Packit 70b277
 * This program is free software; you can redistribute it and/or modify
Packit 70b277
 * it under the terms of the GNU General Public License as published by
Packit 70b277
 * the Free Software Foundation; either version 3, or (at your option)
Packit 70b277
 * any later version.
Packit 70b277
 *
Packit 70b277
 * This program is distributed in the hope that it will be useful,
Packit 70b277
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 70b277
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 70b277
 * GNU General Public License for more details.
Packit 70b277
 *
Packit 70b277
 * You should have received a copy of the GNU General Public License
Packit 70b277
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit 70b277
 *
Packit 70b277
 */
Packit 70b277
Packit 70b277
#ifdef HAVE_LIMITS_H
Packit 70b277
# include <limits.h>	/* UCHAR_MAX */
Packit 70b277
#endif
Packit 70b277
#ifndef UCHAR_MAX
Packit 70b277
# define UCHAR_MAX ((unsigned char)~0)
Packit 70b277
#endif
Packit 70b277
Packit 70b277
/* determine how many register stacks there are */
Packit 70b277
#ifndef DC_REGCOUNT
Packit 70b277
# define DC_REGCOUNT (UCHAR_MAX+1)
Packit 70b277
#endif
Packit 70b277
Packit 70b277
/* efficiency hack for masking arbritrary integers to 0..(DC_REGCOUNT-1) */
Packit 70b277
#if (DC_REGCOUNT & (DC_REGCOUNT-1)) == 0	/* DC_REGCOUNT is power of 2 */
Packit 70b277
# define regmap(r)	((r) & (DC_REGCOUNT-1))
Packit 70b277
#else
Packit 70b277
# define regmap(r)	((r) % DC_REGCOUNT)
Packit 70b277
#endif