home *** CD-ROM | disk | FTP | other *** search
/ Compressed Image File Formats / CompressedImageFileFormatsJohnMiano.iso / pc / Examples / c03 / inc / xbmpvt.h < prev   
Encoding:
C/C++ Source or Header  |  1998-12-17  |  1.2 KB  |  49 lines

  1. #ifndef __XBMPVT_H
  2. #define __XBMPVT_H
  3. //
  4. // Copyright (c) 1997,1998 Colosseum Builders, Inc.
  5. // All rights reserved.
  6. //
  7. // Colosseum Builders, Inc. makes no warranty, expressed or implied
  8. // with regards to this software. It is provided as is.
  9. //
  10. // See the README.TXT file that came with this software for restrictions
  11. // on the use and redistribution of this file or send E-mail to
  12. // info@colosseumbuilders.com
  13. //
  14.  
  15. //
  16. //  Title:  XBM Decoder/Encoder Shared Functions
  17. //
  18. //  Author:  John M. Miano  miano@colosseumbuilers.com
  19. //
  20.  
  21. //
  22. //  Description:
  23. //
  24. //    This function exchanges the bits within a byte.  The
  25. //    most significant bit becomes least significant.
  26. //
  27. //    The BitmapImage class stores bits from left to right
  28. //    from high order to low order. The XBM format is the
  29. //    opposite: Left is in the low order bits.
  30. //
  31. //  Return Value:
  32. //    The rotated byte
  33. //
  34. #include <limits.h>
  35.  
  36. static inline UBYTE1 RotateByte (UBYTE1 value)
  37. {
  38.   UBYTE1 result = 0 ;
  39.  
  40.   for (unsigned int ii = 0 ; ii < CHAR_BIT ; ++ ii)
  41.   {
  42.     if ((value & (1 << (CHAR_BIT - ii - 1))) != 0)
  43.       result |= (1 << ii) ;
  44.   }
  45.   return result ;
  46. }
  47.  
  48. #endif
  49.