home *** CD-ROM | disk | FTP | other *** search
- /*
- digpow2.c
-
- % Function for getting power of 2 of a number of bits.
-
- 5/05/89 by Ted.
-
- OWL-DIG 1.2
- Copyright (c) 1988, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 3/28/90 jmd ansi-fied
- 4/14/90 jmd added olimits.h
- 10/31/90 ted made dig_powof2 return unsigned long instead of long.
- */
-
- #include "oakhead.h"
- #include "disppriv.h"
- #include "digutil.h"
- #include "olimits.h"
-
- /* -------------------------------------------------------------------------- */
-
- unsigned long DIGPRIV dig_powof2(byte power)
- /*
- Return the power of 2 for selected powers expected to be found as the
- number of color bits in display hardware.
- */
- {
- switch (power) {
- default:return(1L);
- case 1: return(2L);
- case 2: return(4L);
- case 4: return(16L);
- case 8: return(256L);
- case 16: return(256L * 256L);
- case 18: return(512L * 512L);
- case 20: return(1024L * 1024L * 16L);
- case 24: return(1024L * 1024L * 16L);
- case 32: return(ULONG_MAX);
- }
- }
- /* -------------------------------------------------------------------------- */
-
-