home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c185 / 2.ddi / OWLSRC.EXE / CSCAPE / SOURCE / DIGPOW2.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-06  |  949 b   |  43 lines

  1. /*
  2.     digpow2.c
  3.  
  4.     % Function for getting power of 2 of a number of bits.
  5.  
  6.     5/05/89  by Ted.
  7.  
  8.     OWL 1.1
  9.     Copyright (c) 1988, by Oakland Group, Inc.
  10.     ALL RIGHTS RESERVED.
  11.  
  12.     Revision History:
  13.     -----------------
  14. */
  15.  
  16. #include "oakhead.h"
  17. #include "disppriv.h"
  18. #include "digutil.h"
  19. /* -------------------------------------------------------------------------- */
  20.  
  21. long DIGPRIV dig_powof2(power)
  22.     byte power;
  23. /*
  24.     Return the power of 2 for selected powers expected to be found as the
  25.     number of color bits in display hardware.
  26. */
  27. {
  28.     switch (power) {
  29.     default:return(1L);
  30.     case 1:  return(2L);
  31.     case 2:  return(4L);
  32.     case 4:  return(16L);
  33.     case 8:  return(256L);
  34.     case 16: return(256L * 256L);
  35.     case 18: return(512L * 512L);
  36.     case 20: return(1024L * 1024L * 16L);
  37.     case 24: return(1024L * 1024L * 16L);
  38.     case 32: return(ULONG_MAX);
  39.     }
  40. }
  41. /* -------------------------------------------------------------------------- */
  42.  
  43.