machine.h

Go to the documentation of this file.
00001 /*                       M A C H I N E . H
00002  * BRL-CAD
00003  *
00004  * Copyright (c) 2004-2006 United States Government as represented by
00005  * the U.S. Army Research Laboratory.
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License
00009  * as published by the Free Software Foundation; either version 2.1 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Library General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this file; see the file named COPYING for more
00019  * information.
00020  */
00021 /** @addtogroup fixme */
00022 /*@{*/
00023 /** @file machine.h
00024  *@brief
00025  *  This header file defines all the
00026  *      fundamental data types (lower case names, created with "typedef")
00027  *  and
00028  *      fundamental manifest constants (upper case, created with "#define")
00029  *  used throughout the BRL-CAD Package.  Virtually all other BRL-CAD
00030  *  header files depend on this header file being included first.
00031  *
00032  *  Many of these fundamental data types are machine (vendor) dependent.
00033  *  Some may assume different values on the same machine, depending on
00034  *  which version of the compiler is being used.
00035  *
00036  *  Additions will need to be made here when porting BRL-CAD to a new machine
00037  *  which is anything but a 32-bit big-endian uniprocessor.
00038  *
00039  *  General Symbols and Types Defined -
00040  *
00041  *      genptr_t -
00042  *              A portable way of declaring a "generic" pointer that is
00043  *              wide enough to point to anything, which can be used on
00044  *              both ANSI C and K&R C environments.
00045  *              On some machines, pointers to functions can be wider than
00046  *              pointers to data bytes, so a declaration of "char *"
00047  *              isn't generic enough.
00048  *
00049  *      fastf_t -
00050  *              Intended to be the fastest floating point data type on
00051  *              the current machine, with at least 64 bits of precision.
00052  *              On 16 and 32 bit machine, this is typically "double",
00053  *              but on 64 bit machines, it is often "float".
00054  *              Virtually all floating point variables (and more complicated
00055  *              data types, like vect_t and mat_t) are defined as fastf_t.
00056  *              The one exception is when a subroutine return is a floating
00057  *              point value;  that is always declared as "double".
00058  *
00059  *      LOCAL -
00060  *              The fastest storage class for local variables within a
00061  *              subroutine.  On parallel machines, this needs to be "auto",
00062  *              but on serial machines there can sometimes be a performance
00063  *              advantage to using "static".
00064  *
00065  *      FAST -
00066  *              The fastest storage class for fastf_t variables.
00067  *              On most machines with abundant registers, this is "register",
00068  *              but on machines like the VAX with only 3 "register double"s
00069  *              available to C programmers, it is set to LOCAL.
00070  *              Thus, declaring a fast temporary fastf_t variable is done like:
00071  *                      FAST fastf_t var;
00072  *
00073  *      HIDDEN -
00074  *              Functions intended to be local to one module should be
00075  *              declared HIDDEN.  For production use, and lint, it will
00076  *              be defined as "static", but for debugging it can be defined
00077  *              as NIL, so that the routine names can be made available
00078  *              to the debugger.
00079  *
00080  *      MAX_FASTF -
00081  *              Very close to the largest value that can be held by a
00082  *              fastf_t without overflow.  Typically specified as an
00083  *              integer power of ten, to make the value easy to spot when
00084  *              printed.
00085  *
00086  *      SQRT_MAX_FASTF -
00087  *              sqrt(MAX_FASTF), or slightly smaller.  Any number larger than
00088  *              this, if squared, can be expected to produce an overflow.
00089  *
00090  *      SMALL_FASTF -
00091  *              Very close to the smallest value that can be represented
00092  *              while still being greater than zero.  Any number smaller
00093  *              than this (and non-negative) can be considered to be
00094  *              zero;  dividing by such a number can be expected to produce
00095  *              a divide-by-zero error.
00096  *              All divisors should be checked against this value before
00097  *              actual division is performed.
00098  *
00099  *      SQRT_SMALL_FASTF -
00100  *              sqrt(SMALL_FASTF), or slightly larger.  The value of this
00101  *              is quite a lot larger than that of SMALL_FASTF.
00102  *              Any number smaller than this, when squared, can be expected
00103  *              to produce a zero result.
00104  *
00105  *      bzero(ptr,n) -
00106  *              Defined to be the fasted system-specific method for
00107  *              zeroing a block of 'n' bytes, where the pointer has
00108  *              arbitrary byte alignment.
00109  *
00110  *      bcopy(from,to,n) -
00111  *              Defined to be the fastest system-specific method for
00112  *              copying a block of 'n' bytes, where both the "from" and
00113  *              "to" pointers have arbitrary byte alignment.
00114  *
00115  *      bitv_t -
00116  *              The widest fast integer type available, used to implement bit
00117  *              vectors.  On most machines, this is "long", but on some
00118  *              machines a vendor-specific type such as "long long" can
00119  *              give access to wider integers.
00120  *
00121  *      BITV_SHIFT -
00122  *              log2( bits_wide(bitv_t) ).  Used to determine how many
00123  *              bits of a bit-vector subscript are index-of-bit in bitv_t
00124  *              word, and how many bits of the subscript are for word index.
00125  *              On a 32-bit machine, BITV_SHIFT is 5.
00126  *
00127  *      XXX The BYTE_ORDER handling needs to change to match the POSIX
00128  *      XXX recommendations.
00129  *
00130  *  PARALLEL Symbols Defined -
00131  *    These are used only for applications linked with LIBRT,
00132  *    and interact heavily with the support routines in librt/machine.c
00133  *    XXX These are likely to get new, more descriptive names sometime.
00134  *
00135  *      PARALLEL -
00136  *              When defined, the code is being compiled for a parallel processor.
00137  *              This has implications for signal handling, math library
00138  *              exception handling, etc.
00139  *
00140  *      MAX_PSW -
00141  *              The maximum number of processors that can be expected on
00142  *              this hardware.  Used to allocate application-specific
00143  *              per-processor tables.
00144  *              The actual number of processors is found at runtime by calling
00145  *              rt_avail_cpus().
00146  *
00147  *      DEFAULT_PSW -
00148  *              The number of processors to use when the user has not
00149  *              specifically indicated the number of processors desired.
00150  *              On some machines like the Alliant, this should be MAX_PSW,
00151  *              because the parallel complex is allocated as a unit.
00152  *              On timesharing machines like the Cray, this should be 1,
00153  *              because running multi-tasking consumes special resources
00154  *              (and sometimes requires special queues/privs), so ordinary
00155  *              runs should just stay serial.
00156  *
00157  *      MALLOC_NOT_MP_SAFE -
00158  *              Defined when the system malloc() routine can not be
00159  *              safely used in a multi-processor (MP) execution.
00160  *              If defined, LIBBU will protect with BU_SEM_SYSCALL.
00161  *
00162  *  @author
00163  *      Michael John Muuss
00164  *
00165  *  @par Source
00166  *      The U. S. Army Research Laboratory
00167  *      Aberdeen Proving Ground, Maryland  21005
00168  *
00169  *
00170  *  Include Sequencing -
00171  *      # include "machine.h"
00172  *@n    # include "bu.h"
00173  *
00174  *  Libraries Used -
00175  *      LIBBU LIBBU_LIBES -lm -lc
00176  *
00177  *  $Header: /cvsroot/brlcad/brlcad/include/machine.h,v 14.20 2006/09/18 05:24:07 lbutler Exp $
00178  */
00179 
00180 #ifndef MACHINE_H
00181 #define MACHINE_H seen
00182 
00183 #include "common.h"
00184 
00185 /* needed for FOPEN_MAX */
00186 #include <stdio.h>
00187 
00188 
00189 /*
00190  * Figure out the maximum number of files that can simultaneously be open
00191  * by a process.
00192  */
00193 
00194 #if !defined(FOPEN_MAX) && defined(_NFILE)
00195 #       define FOPEN_MAX        _NFILE
00196 #endif
00197 #if !defined(FOPEN_MAX) && defined(NOFILE)
00198 #       define FOPEN_MAX        NOFILE
00199 #endif
00200 #if !defined(FOPEN_MAX) && defined(OPEN_MAX)
00201 #       define FOPEN_MAX        OPEN_MAX
00202 #endif
00203 #if !defined(FOPEN_MAX) && defined(_SYS_OPEN)
00204 #       define FOPEN_MAX        _SYS_OPEN
00205 #endif
00206 #if !defined(FOPEN_MAX)
00207 #       define FOPEN_MAX        32
00208 #endif
00209 
00210 /**********************************
00211  *                                *
00212  *  Machine specific definitions  *
00213  *  Choose for maximum speed      *
00214  *                                *
00215  **********************************/
00216 
00217 
00218 #ifdef _WIN32
00219 /********************************
00220  *                              *
00221  *  Windows Windows             *
00222  *                              *
00223  ********************************/
00224 typedef double fastf_t;
00225 #define LOCAL auto
00226 #define FAST register
00227 typedef long bitv_t;
00228 #define BITV_SHIFT      5
00229 /* assume only one processor for now */
00230 #define MAX_PSW 4
00231 #define DEFAULT_PSW     1
00232 #define MALLOC_NOT_MP_SAFE 1
00233 
00234 #endif /* _WIN32 */
00235 
00236 
00237 #ifdef HEP
00238 /********************************
00239  *                              *
00240  *  Denelcor HEP H-1000         *
00241  *                              *
00242  ********************************/
00243 #define IBM_FLOAT 1             /* Uses IBM style floating point */
00244 typedef double  fastf_t;        /* double|float, "Fastest" float type */
00245 #define LOCAL   auto            /* static|auto, for serial|parallel cpu */
00246 #define FAST    register        /* LOCAL|register, for fastest floats */
00247 typedef long    bitv_t;         /* largest integer type */
00248 #define BITV_SHIFT      6       /* log2( bits_wide(bitv_t) ) */
00249 
00250 #define MAX_PSW         128     /* Max number of process streams */
00251 #define DEFAULT_PSW     MAX_PSW
00252 #define PARALLEL        1
00253 #endif
00254 
00255 
00256 #if defined(__alpha)
00257 /********************************
00258  *                              *
00259  *        DEC Alpha (AXP)       *
00260  *                              *
00261  ********************************/
00262 #define IEEE_FLOAT 1            /* Uses IEEE style floating point */
00263 #if !defined(LITTLE_ENDIAN)
00264         /* Often defined in <alpha/endian.h> */
00265 #       define LITTLE_ENDIAN    1       /* Under the influence of Intel Corp */
00266 #endif
00267 typedef double  fastf_t;        /* double|float, "Fastest" float type */
00268 #define LOCAL   auto            /* static|auto, for serial|parallel cpu */
00269 #define FAST    register        /* LOCAL|register, for fastest floats */
00270 typedef long    bitv_t;         /* largest integer type */
00271 #define BITV_SHIFT      6       /* log2( bits_wide(bitv_t) ) */
00272 
00273 #define MAX_PSW         1       /* only one processor, max */
00274 #define DEFAULT_PSW     1
00275 #endif
00276 
00277 
00278 #if defined(alliant) && !defined(i860)
00279 /********************************
00280  *                              *
00281  *      Alliant FX/8            *
00282  *                              *
00283  ********************************/
00284 #define IEEE_FLOAT 1            /* Uses IEEE style floating point */
00285 typedef double  fastf_t;        /* double|float, "Fastest" float type */
00286 #define LOCAL   auto            /* static|auto, for serial|parallel cpu */
00287 #define FAST    register        /* LOCAL|register, for fastest floats */
00288 typedef long    bitv_t;         /* largest integer type */
00289 #define BITV_SHIFT      5       /* log2( bits_wide(bitv_t) ) */
00290 
00291 #define MAX_PSW         8       /* Max number of processors */
00292 #define DEFAULT_PSW     MAX_PSW
00293 #define PARALLEL        1
00294 
00295 #endif
00296 
00297 
00298 #if defined(alliant) && defined(i860)
00299 /********************************
00300  *                              *
00301  *      Alliant FX/2800         *
00302  *                              *
00303  ********************************/
00304 #define IEEE_FLOAT 1            /* Uses IEEE style floating point */
00305 #define LITTLE_ENDIAN   1       /* Under the influence of Intel Corp */
00306 typedef double  fastf_t;        /* double|float, "Fastest" float type */
00307 #define LOCAL   auto            /* static|auto, for serial|parallel cpu */
00308 #define FAST    register        /* LOCAL|register, for fastest floats */
00309 typedef long    bitv_t;         /* largest integer type */
00310 #define BITV_SHIFT      5       /* log2( bits_wide(bitv_t) ) */
00311 
00312 #define MAX_PSW         28      /* Max number of processors */
00313 #define DEFAULT_PSW     MAX_PSW
00314 #define PARALLEL        1
00315 
00316 #endif
00317 
00318 
00319 #ifdef CRAY
00320 /********************************
00321  *                              *
00322  *  Cray-X/MP, COS or UNICOS    *
00323  *  Cray-2 under "UNICOS"       *
00324  *                              *
00325  ********************************/
00326 typedef double  fastf_t;        /* double|float, "Fastest" float type */
00327 #define LOCAL   auto            /* static|auto, for serial|parallel cpu */
00328 #define FAST    register        /* LOCAL|register, for fastest floats */
00329 typedef long    bitv_t;         /* largest integer type */
00330 #define BITV_SHIFT      6       /* log2( bits_wide(bitv_t) ) */
00331 
00332 #define MAX_PSW         4       /* Max number of processors */
00333 #define DEFAULT_PSW     1
00334 #define PARALLEL        1
00335 
00336 #  if 0
00337 #       define CRAY_COS 1       /* Running on Cray under COS w/bugs */
00338 #  endif
00339 #endif
00340 
00341 #if defined(convex) || defined(__convex__)
00342 /********************************
00343  *                              *
00344  *  Convex C1 & C2              *
00345  *                              *
00346  ********************************/
00347 typedef double          fastf_t;/* double|float, "Fastest" float type */
00348 #define LOCAL           auto    /* static|auto, for serial|parallel cpu */
00349 #define FAST            register /* LOCAL|register, for fastest floats */
00350 #if 1
00351 typedef long long       bitv_t; /* largest integer type */
00352 #define BITV_SHIFT      6       /* log2( bits_wide(bitv_t) ) */
00353 #else
00354 typedef long            bitv_t;
00355 #define BITV_SHIFT      5
00356 #endif
00357 
00358 #define MAX_PSW         4       /* Max number of processors */
00359 #define DEFAULT_PSW     1       /* for now */
00360 #define PARALLEL        1
00361 #endif
00362 
00363 #ifdef ardent
00364 /********************************
00365  *                              *
00366  *  Stardent (formerly Ardent)  *
00367  *  "Titan" Workstation         *
00368  *                              *
00369  ********************************/
00370 typedef double  fastf_t;        /* double|float, "Fastest" float type */
00371 #define LOCAL   auto            /* for parallel cpus */
00372 #define FAST    register        /* LOCAL|register, for fastest floats */
00373 typedef long    bitv_t;         /* largest integer type */
00374 #define BITV_SHIFT      5       /* log2( bits_wide(bitv_t) ) */
00375 
00376 #define MAX_PSW         4       /* # processors, max */
00377 #define DEFAULT_PSW     1
00378 #define PARALLEL        1
00379 #endif
00380 
00381 #ifdef __stardent
00382 /********************************
00383  *                              *
00384  *  Stardent VISTRA Workstation *
00385  *  based on Intel i860 chip    *
00386  *                              *
00387  ********************************/
00388 #define __unix  1               /* It really is unix */
00389 #define LITTLE_ENDIAN   1       /* Under the influence of Intel Corp */
00390 typedef double  fastf_t;        /* double|float, "Fastest" float type */
00391 #define LOCAL   auto            /* for parallel cpus */
00392 #define FAST    register        /* LOCAL|register, for fastest floats */
00393 typedef long    bitv_t;         /* largest integer type */
00394 #define BITV_SHIFT      5       /* log2( bits_wide(bitv_t) ) */
00395 
00396 #define MAX_PSW         1       /* only one processor, max */
00397 #define DEFAULT_PSW     1
00398 #endif
00399 
00400 #if     (defined(__sgi) && defined(__mips))
00401 /* Strict ANSI C does not define CPP symbols that don't start with __ */
00402 #       define sgi      1
00403 #       define mips     1
00404 #endif
00405 #if     (defined(sgi) && defined(mips))
00406 /********************************
00407  *                              *
00408  *  SGI 4D, multi-processor     *
00409  *                              *
00410  ********************************/
00411 #define IEEE_FLOAT 1            /* Uses IEEE style floating point */
00412 typedef double  fastf_t;        /* double|float, "Fastest" float type */
00413 #define LOCAL   auto            /* static|auto, for serial|parallel cpu */
00414 #define FAST    register        /* LOCAL|register, for fastest floats */
00415 typedef long    bitv_t;         /* largest integer type */
00416 #if defined( _MIPS_SZLONG ) && _MIPS_SZLONG == 64
00417 #define BITV_SHIFT      6       /* log2( bits_wide(bitv_t) ) */
00418 #else
00419 #define BITV_SHIFT      5       /* log2( bits_wide(bitv_t) ) */
00420 #endif
00421 #define const   const
00422 
00423 #define MAX_PSW         1024
00424 #define DEFAULT_PSW     MAX_PSW
00425 #define PARALLEL        1
00426 
00427 #endif
00428 
00429 #ifdef apollo
00430 /********************************
00431  *                              *
00432  *  Apollo                      *
00433  *  with SR 10                  *
00434  *                              *
00435  ********************************/
00436 #if __STDC__
00437 #define const   /**/            /* Does not support const keyword */
00438 #define const   /**/            /* Does not support const keyword */
00439 #endif
00440 
00441 typedef double  fastf_t;        /* double|float, "Fastest" float type */
00442 #define LOCAL   static          /* static|auto, for serial|parallel cpu */
00443 #define FAST    LOCAL           /* LOCAL|register, for fastest floats */
00444 typedef long    bitv_t;         /* largest integer type */
00445 #define BITV_SHIFT      5       /* log2( bits_wide(bitv_t) ) */
00446 
00447 #define MAX_PSW         1       /* only one processor, max */
00448 #define DEFAULT_PSW     1
00449 #define MALLOC_NOT_MP_SAFE 1
00450 
00451 #endif
00452 
00453 
00454 #ifdef n16
00455 /********************************
00456  *                              *
00457  *     Encore Multi-Max         *
00458  *                              *
00459  ********************************/
00460 #define IEEE_FLOAT      1       /* Uses IEEE style floating point */
00461 #define LITTLE_ENDIAN   1       /* Under the influence of National Semiconductor */
00462 typedef double  fastf_t;        /* double|float, "Fastest" float type */
00463 #define LOCAL   auto            /* static|auto, for serial|parallel cpu */
00464 #define FAST    register        /* LOCAL|register, for fastest floats */
00465 typedef long    bitv_t;         /* largest integer type */
00466 #define BITV_SHIFT      5       /* log2( bits_wide(bitv_t) ) */
00467 
00468 #define MAX_PSW         32      /* This number is uncertain */
00469 #define DEFAULT_PSW     1
00470 #define PARALLEL        1
00471 #define MALLOC_NOT_MP_SAFE 1
00472 #endif
00473 
00474 #ifdef ipsc860
00475 /********************************
00476  *                              *
00477  *   Intel iPSC/860 Hypercube   *
00478  *                              *
00479  ********************************/
00480 /* icc compiler gets confused on const typedefs */
00481 #define const   /**/
00482 #define const   /**/
00483 #define MALLOC_NOT_MP_SAFE 1
00484 #endif
00485 
00486 #if defined(SUNOS) && SUNOS >= 50
00487 /********************************
00488  *                              *
00489  *   Sun Running Solaris 2.X    *
00490  *   aka SunOS 5.X              *
00491  *                              *
00492  ********************************/
00493 
00494 #define IEEE_FLOAT 1            /* Uses IEEE style floating point */
00495 typedef double  fastf_t;        /* double|float, "Fastest" float type */
00496 #define LOCAL   auto            /* static|auto, for serial|parallel cpu */
00497 #define FAST    register        /* LOCAL|register, for fastest floats */
00498 typedef long    bitv_t;         /* largest integer type */
00499 #define BITV_SHIFT      5       /* log2( bits_wide(bitv_t) ) */
00500 
00501 #define MAX_PSW         256     /* need to increase this for Super Dragon? */
00502 #define DEFAULT_PSW     bu_avail_cpus()
00503 #define PARALLEL        1
00504 
00505 #endif
00506 
00507 #if defined(hppa)
00508 /********************************
00509  *                              *
00510  *   HP 9000/700                *
00511  *   Running HP-UX 9.1          *
00512  *                              *
00513  ********************************/
00514 
00515 #define IEEE_FLOAT 1            /* Uses IEEE style floating point */
00516 typedef double  fastf_t;        /* double|float, "Fastest" float type */
00517 #define LOCAL   auto            /* static|auto, for serial|parallel cpu */
00518 #define FAST    register        /* LOCAL|register, for fastest floats */
00519 typedef long    bitv_t;         /* largest integer type */
00520 #define BITV_SHIFT      5       /* log2( bits_wide(bitv_t) ) */
00521 
00522 #define const   /**/            /* Does not support const keyword */
00523 #define const   /**/            /* Does not support const keyword */
00524 
00525 #define MAX_PSW         1       /* only one processor, max */
00526 #define DEFAULT_PSW     1
00527 #define MALLOC_NOT_MP_SAFE 1
00528 
00529 #endif
00530 
00531 #ifdef __APPLE__
00532 #ifdef __ppc__
00533 /********************************
00534  *                              *
00535  *      Macintosh PowerPC       *
00536  *                              *
00537  ********************************/
00538 #define IEEE_FLOAT      1       /* Uses IEEE style floating point */
00539 typedef double  fastf_t;        /* double|float, "Fastest" float type */
00540 #define LOCAL   auto            /* static|auto, for serial|parallel cpu */
00541 #define FAST    register        /* LOCAL|register, for fastest floats */
00542 typedef long    bitv_t;         /* could use long long */
00543 #define BITV_SHIFT      5       /* log2( bits_wide(bitv_t) ) */
00544 #define MAX_PSW         512       /* Unused, but useful for thread debugging */
00545 #define DEFAULT_PSW     bu_avail_cpus() /* use as many as we can */
00546 #define PARALLEL        1
00547 /* #define MALLOC_NOT_MP_SAFE 1 -- not confirmed */
00548 #endif
00549 #ifdef __i686__
00550 #define IEEE_FLOAT      1      /* Uses IEEE style floating point */
00551 typedef double  fastf_t;        /* double|float, "Fastest" float type */
00552 #define LOCAL   auto            /* static|auto, for serial|parallel cpu */
00553 #define FAST    register        /* LOCAL|register, for fastest floats */
00554 typedef long    bitv_t;         /* could use long long */
00555 #define BITV_SHIFT      5      /* log2( bits_wide(bitv_t) ) */
00556 #define MAX_PSW         512       /* Unused, but useful for thread debugging */
00557 #define DEFAULT_PSW     bu_avail_cpus() /* use as many as we can */
00558 #define PARALLEL        1
00559 #endif
00560 
00561 #endif
00562 
00563 #ifdef __sp3__
00564 /********************************
00565  *                              *
00566  *      IBM SP3                 *
00567  *                              *
00568  ********************************/
00569 #define IEEE_FLOAT      1       /* Uses IEEE style floating point */
00570 typedef double  fastf_t;        /* double|float, "Fastest" float type */
00571 #define LOCAL   auto            /* static|auto, for serial|parallel cpu */
00572 #define FAST    register        /* LOCAL|register, for fastest floats */
00573 typedef long    bitv_t;         /* largest integer type */
00574 #define BITV_SHIFT      5       /* log2( bits_wide(bitv_t) ) */
00575 
00576 #if 1   /* Multi-CPU SP3 build */
00577 #       define MAX_PSW          32      /* they can go 32-way per single image */
00578 #       define DEFAULT_PSW      bu_avail_cpus() /* use as many as are configured by default */
00579 #       define  PARALLEL        1
00580 #       define  MALLOC_NOT_MP_SAFE      1       /* XXX Not sure about this */
00581 #else   /* 1 CPU SP3 build */
00582 #       define MAX_PSW          1       /* only one processor, max */
00583 #       define DEFAULT_PSW      1
00584 #endif
00585 
00586 #endif
00587 
00588 #ifdef __ia64__
00589 /********************************
00590  *                              *
00591  *      SGI Altix               *
00592  *                              *
00593  ********************************/
00594 #define IEEE_FLOAT      1       /* Uses IEEE style floating point */
00595 typedef double  fastf_t;        /* double|float, "Fastest" float type */
00596 #define LOCAL   auto            /* static|auto, for serial|parallel cpu */
00597 #define FAST    register        /* LOCAL|register, for fastest floats */
00598 typedef long    bitv_t;         /* largest integer type */
00599 #define BITV_SHIFT      6       /* log2( bits_wide(bitv_t) ) */
00600 
00601 #if 1   /* Multi-CPU Altix build */
00602 #       define DEFAULT_PSW      bu_avail_cpus()
00603 #       define MAX_PSW          256
00604 #       define  PARALLEL        1
00605 #       define MALLOC_NOT_MP_SAFE       1       /* XXX Not sure about this */
00606 #else   /* 1 CPU Altix build */
00607 #       define MAX_PSW          1       /* only one processor, max */
00608 #       define DEFAULT_PSW      1
00609 #       define MALLOC_NOT_MP_SAFE       1       /* XXX Not sure about this */
00610 #endif
00611 
00612 #endif
00613 
00614 #if defined(__sparc64__)
00615 /********************************
00616  *                              *
00617  *      Sparc 64                *
00618  *                              *
00619  ********************************/
00620 #define IEEE_FLOAT      1       /* Uses IEEE style floating point */
00621 typedef double  fastf_t;        /* double|float, "Fastest" float type */
00622 #define LOCAL   auto            /* static|auto, for serial|parallel cpu */
00623 #define FAST    register        /* LOCAL|register, for fastest floats */
00624 typedef long    bitv_t;         /* largest integer type */
00625 #define BITV_SHIFT      6       /* log2( bits_wide(bitv_t) ) */
00626 #define DEFAULT_PSW     bu_avail_cpus()
00627 #define MAX_PSW         256
00628 #define PARALLEL        1
00629 #define MALLOC_NOT_MP_SAFE      1       /* XXX Not sure about this */
00630 
00631 #endif
00632 
00633 
00634 #if defined(linux) && defined(__x86_64__)
00635 /********************************
00636  *                              *
00637  *      AMD Opteron Linux       *
00638  *                              *
00639  ********************************/
00640 #define IEEE_FLOAT      1       /* Uses IEEE style floating point */
00641 typedef double  fastf_t;        /* double|float, "Fastest" float type */
00642 #define LOCAL   auto            /* static|auto, for serial|parallel cpu */
00643 #define FAST    register        /* LOCAL|register, for fastest floats */
00644 typedef long    bitv_t;         /* largest integer type */
00645 #define BITV_SHIFT      6       /* log2( bits_wide(bitv_t) ) */
00646 #define DEFAULT_PSW     bu_avail_cpus()
00647 #define MAX_PSW         256
00648 #define PARALLEL        1
00649 #define MALLOC_NOT_MP_SAFE      1       /* XXX Not sure about this */
00650 
00651 #endif
00652 
00653 #if defined (linux) && !defined(__ia64__) && !defined(__x86_64__) && !defined(__sparc64__)
00654 /********************************
00655  *                              *
00656  *        Linux on IA32         *
00657  *                              *
00658  ********************************/
00659 #define IEEE_FLOAT      1      /* Uses IEEE style floating point */
00660 #define BITV_SHIFT      5      /* log2( bits_wide(bitv_t) ) */
00661 
00662 typedef double fastf_t;       /* double|float, "Fastest" float type */
00663 typedef long bitv_t;          /* could use long long */
00664 
00665 /*
00666  * Note that by default a Linux installation supports parallel using
00667  * pthreads. For a 1 cpu installation, toggle these blocks
00668  */
00669 # if 1 /* multi-cpu linux build */
00670 
00671 # define LOCAL auto             /* static|auto, for serial|parallel cpu */
00672 # define FAST register          /* LOCAL|register, for fastest floats */
00673 # define MAX_PSW         16
00674 # define DEFAULT_PSW     bu_avail_cpus()        /* use as many processors as are available */
00675 # define PARALLEL        1
00676 # define MALLOC_NOT_MP_SAFE 1   /* uncertain, but this is safer for now */
00677 
00678 # else  /* 1 CPU Linux build */
00679 
00680 # define LOCAL static           /* static|auto, for serial|parallel cpu */
00681 # define FAST LOCAL             /* LOCAL|register, for fastest floats */
00682 # define MAX_PSW        1       /* only one processor, max */
00683 # define DEFAULT_PSW    1
00684 
00685 # endif
00686 #endif /* linux */
00687 
00688 
00689 /********************************
00690  *                              *
00691  *    FreeBSD/NetBSD/OpenBSD    *
00692  *                              *
00693  ********************************/
00694 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) 
00695 typedef double          fastf_t;        /* double|float, "Fastest" float type */
00696 typedef long            bitv_t;         /* largest integer type */
00697 # define IEEE_FLOAT     1               /* Uses IEEE style floating point */
00698 # define FAST           register        /* LOCAL|register, for fastest floats */
00699 # define DEFAULT_PSW    bu_avail_cpus()
00700 # define        PARALLEL        1
00701 # define MALLOC_NOT_MP_SAFE     1       /* XXX Not sure about this */
00702 # define LOCAL          auto            /* static|auto, for serial|parallel cpu */
00703 
00704 /* amd64 */
00705 # if defined(__x86_64__)
00706 #  define BITV_SHIFT    6
00707 #  define MAX_PSW               256
00708 /* ia32 */
00709 # elif !defined(__ia64__) && !defined(__x86_64__) && !defined(__sparc64__)
00710 #  define BITV_SHIFT    5
00711 #  define MAX_PSW       16
00712 # endif
00713 #endif /* BSD */
00714 
00715 #ifndef LOCAL
00716 /********************************
00717  *                              *
00718  * Default 32-bit uniprocessor  *
00719  *  VAX, Gould, SUN, SGI        *
00720  *                              *
00721  ********************************/
00722 typedef double  fastf_t;        /* double|float, "Fastest" float type */
00723 #define LOCAL   static          /* static|auto, for serial|parallel cpu */
00724 #define FAST    LOCAL           /* LOCAL|register, for fastest floats */
00725 typedef long    bitv_t;         /* largest integer type */
00726 #define BITV_SHIFT      5       /* log2( bits_wide(bitv_t) ) */
00727 
00728 #define MAX_PSW         4       /* allow for a dual core dual */
00729 #define DEFAULT_PSW     bu_avail_cpus() /* use as many as are available by default */
00730 
00731 #endif
00732 
00733 /*
00734  *  Definitions for big-endian -vs- little-endian.
00735  *      BIG_ENDIAN:     Byte [0] is on left side of word (msb).
00736  *      LITTLE_ENDIAN:  Byte [0] is on right side of word (lsb).
00737  */
00738 #ifdef vax
00739 # define LITTLE_ENDIAN  1
00740 #endif
00741 
00742 #if !defined(BIG_ENDIAN) && !defined(LITTLE_ENDIAN)
00743 # define BIG_ENDIAN     1       /* The common case */
00744 #endif
00745 
00746 /*  Bit vector mask */
00747 #define BITV_MASK       ((1<<BITV_SHIFT)-1)
00748 
00749 /*
00750  * Definitions about limits of floating point representation
00751  * Eventually, should be tied to type of hardware (IEEE, IBM, Cray)
00752  * used to implement the fastf_t type.
00753  */
00754 #if defined(vax) || (defined(sgi) && !defined(mips))
00755         /* DEC VAX "D" format, the most restrictive */
00756 #define MAX_FASTF               1.0e37  /* Very close to the largest number */
00757 #define SQRT_MAX_FASTF          1.0e18  /* This squared just avoids overflow */
00758 #define SMALL_FASTF             1.0e-37 /* Anything smaller is zero */
00759 #define SQRT_SMALL_FASTF        1.0e-18 /* This squared gives zero */
00760 #else
00761         /* IBM format, being the next most restrictive format */
00762 #define MAX_FASTF               1.0e73  /* Very close to the largest number */
00763 #define SQRT_MAX_FASTF          1.0e36  /* This squared just avoids overflow */
00764 #define SMALL_FASTF             1.0e-77 /* Anything smaller is zero */
00765 #if defined(aux)
00766 #  define SQRT_SMALL_FASTF      1.0e-40 /* _doprnt error in libc */
00767 #else
00768 #  define SQRT_SMALL_FASTF      1.0e-39 /* This squared gives zero */
00769 #endif
00770 #endif
00771 #define SMALL                   SQRT_SMALL_FASTF
00772 
00773 /*
00774  *  Definition of a "generic" pointer that can hold a pointer to anything.
00775  *  According to tradition, a (char *) was generic, but the ANSI folks
00776  *  worry about machines where (int *) might be wider than (char *),
00777  *  so here is the clean way of handling it.
00778  */
00779 #if !defined(GENPTR_NULL)
00780 #  if __STDC__
00781         typedef void    *genptr_t;
00782 #  else
00783         typedef char    *genptr_t;
00784 #  endif
00785 #  define GENPTR_NULL   ((genptr_t)0)
00786 #endif
00787 
00788 
00789 /* Even in C++ not all compilers know the "bool" keyword yet */
00790 #if !defined(BOOL_T)
00791 #  define BOOL_T int
00792 #endif
00793 
00794 
00795 /** provide bzero and bcopy */
00796 #if !defined(bzero) && !defined(HAVE_BZERO)
00797 #  include <string.h>
00798 #  define bzero(str,n)          memset( str, 0, n )
00799 #  define bcopy(from,to,count)  memcpy( to, from, count )
00800 #endif
00801 
00802 /* Functions local to one file should be declared HIDDEN:  (nil)|static */
00803 /* To aid in using ADB, generally leave this as nil. */
00804 #if !defined(HIDDEN)
00805 # if defined(lint)
00806 #       define HIDDEN   static
00807 # else
00808 #       define HIDDEN   /***/
00809 # endif
00810 #endif
00811 
00812 /*
00813  *  ANSI and POSIX do not seem to have prototypes for the hypot() routine,
00814  *  but several vendors include it in their -lm math library.
00815  */
00816 #if defined(_POSIX_SOURCE) && !defined(__USE_MISC)
00817         /* But the sgi -lm does have a hypot routine so lets use it */
00818 #if defined(__sgi) || defined(__convexc__)
00819         extern double hypot(double, double);
00820 #else
00821 #  include <math.h>
00822 #  define hypot(x,y)      sqrt( (x)*(x)+(y)*(y) )
00823 #endif
00824 #endif
00825 
00826 #if defined(SUNOS) && SUNOS >= 52
00827 #  include <math.h>
00828         extern double hypot(double, double);
00829 #endif
00830 
00831 #endif  /* MACHINE_H */
00832 /*@}*/
00833 /*
00834  * Local Variables:
00835  * mode: C
00836  * tab-width: 8
00837  * c-basic-offset: 4
00838  * indent-tabs-mode: t
00839  * End:
00840  * ex: shiftwidth=4 tabstop=8
00841  */
00842 

Generated on Mon Sep 18 01:24:41 2006 for BRL-CAD by  doxygen 1.4.6