"Fossies" - the Fresh Open Source Software Archive

Member "bc-1.06.95/dc/dc-regdef.h" (25 May 2005, 1397 Bytes) of package /linux/misc/old/bc-1.06.95.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "dc-regdef.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 1.06.95_vs_1.07.

    1 /*
    2  * definitions for dc's "register" declarations
    3  *
    4  * Copyright (C) 1994, 2000 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  *    51 Franklin Street, Fifth Floor
   22  *    Boston, MA 02110-1301  USA
   23  */
   24 
   25 #ifdef HAVE_LIMITS_H
   26 # include <limits.h>    /* UCHAR_MAX */
   27 #endif
   28 #ifndef UCHAR_MAX
   29 # define UCHAR_MAX ((unsigned char)~0)
   30 #endif
   31 
   32 /* determine how many register stacks there are */
   33 #ifndef DC_REGCOUNT
   34 # define DC_REGCOUNT (UCHAR_MAX+1)
   35 #endif
   36 
   37 /* efficiency hack for masking arbritrary integers to 0..(DC_REGCOUNT-1) */
   38 #if (DC_REGCOUNT & (DC_REGCOUNT-1)) == 0    /* DC_REGCOUNT is power of 2 */
   39 # define regmap(r)  ((r) & (DC_REGCOUNT-1))
   40 #else
   41 # define regmap(r)  ((r) % DC_REGCOUNT)
   42 #endif